public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109494] New: inline const variables interfere with source_location
@ 2023-04-13 7:25 oliver.rosten at googlemail dot com
2023-04-13 14:29 ` [Bug target/109494] " pinskia at gcc dot gnu.org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-13 7:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
Bug ID: 109494
Summary: inline const variables interfere with source_location
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: oliver.rosten at googlemail dot com
Target Milestone: ---
The bug, (for which I'm not sure if it is a front end problem or a library
problem), is reproduced here: https://github.com/ojrosten/SourceLoc
The project comprises three files in the Test directory:
Main.cpp
Test.cpp
Test.hpp
Both the cpps depend on the hpp. The latter contains an unused variable
inline const std::string foo{};
The presence of this seems to cause:
1. The appearance of a warning: "ld: warning: direct access in function ...
from file ... to global weak symbol ... from file ... means the weak symbol
cannot be overridden at runtime..."
2. std::source_location::current() to misbehave: building and running causes
the path to Main.cpp to be output twice, whereas it should just be printed
once, with the path to Test.cpp appearing second.
Any of the following cures both of the problems:
1. Removing foo;
2. Removing inline;
3. Replacing const with constexpr
In the much more complex project where I first encountered this, I reliably got
a segmentation fault. I was able to cure this by removing inline in a handful
of places.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
@ 2023-04-13 14:29 ` pinskia at gcc dot gnu.org
2023-04-13 15:26 ` oliver.rosten at googlemail dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-13 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-04-13
Ever confirmed|0 |1
Component|c++ |target
Keywords|diagnostic |wrong-code
Status|UNCONFIRMED |WAITING
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide the information as requested on https://gcc.gnu.org/bugs/ ?
At least the output of "gcc -v".
Also can you attach the testcase and not use cmake as cmake makes it hard to
figure out the exact command line which is being invoked, a shell script or a
simple make file should be enough?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
2023-04-13 14:29 ` [Bug target/109494] " pinskia at gcc dot gnu.org
@ 2023-04-13 15:26 ` oliver.rosten at googlemail dot com
2023-04-13 15:27 ` oliver.rosten at googlemail dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-13 15:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #2 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Created attachment 54851
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54851&action=edit
Preprocessed file
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
2023-04-13 14:29 ` [Bug target/109494] " pinskia at gcc dot gnu.org
2023-04-13 15:26 ` oliver.rosten at googlemail dot com
@ 2023-04-13 15:27 ` oliver.rosten at googlemail dot com
2023-04-14 15:31 ` ppalka at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-13 15:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #3 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Created attachment 54852
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54852&action=edit
Preprocessed file for Test.cpp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (2 preceding siblings ...)
2023-04-13 15:27 ` oliver.rosten at googlemail dot com
@ 2023-04-14 15:31 ` ppalka at gcc dot gnu.org
2023-04-14 15:45 ` ppalka at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-04-14 15:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
I can't reproduce the linker warning or bad output with GCC 12.2 or trunk on
x86_64-pc-linux-gnu:
$ g++ -std=c++20 -fext-numeric-literals Main.ii Test.ii
$ ./a.out
/Users/Claire/Dropbox/SourceLoc/Test/Main.cpp
/Users/Claire/Dropbox/SourceLoc/Test/Test.cpp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (3 preceding siblings ...)
2023-04-14 15:31 ` ppalka at gcc dot gnu.org
@ 2023-04-14 15:45 ` ppalka at gcc dot gnu.org
2023-04-15 21:19 ` oliver.rosten at googlemail dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-04-14 15:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #4)
> I can't reproduce the linker warning or bad output with GCC 12.2 or trunk on
> x86_64-pc-linux-gnu:
>
> $ g++ -std=c++20 -fext-numeric-literals Main.ii Test.ii
> $ ./a.out
> /Users/Claire/Dropbox/SourceLoc/Test/Main.cpp
> /Users/Claire/Dropbox/SourceLoc/Test/Test.cpp
Oops, it was already established this is a darwin-specific issue, sorry for the
noise.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (4 preceding siblings ...)
2023-04-14 15:45 ` ppalka at gcc dot gnu.org
@ 2023-04-15 21:19 ` oliver.rosten at googlemail dot com
2023-04-15 21:21 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-15 21:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #6 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
I've added a simple makefile to the project:
https://github.com/ojrosten/SourceLoc
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (5 preceding siblings ...)
2023-04-15 21:19 ` oliver.rosten at googlemail dot com
@ 2023-04-15 21:21 ` pinskia at gcc dot gnu.org
2023-04-15 21:30 ` oliver.rosten at googlemail dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 21:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You still didn't provide the full output.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (6 preceding siblings ...)
2023-04-15 21:21 ` pinskia at gcc dot gnu.org
@ 2023-04-15 21:30 ` oliver.rosten at googlemail dot com
2023-04-15 21:35 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-15 21:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #8 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Created attachment 54870
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54870&action=edit
Output from gcc -v
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (7 preceding siblings ...)
2023-04-15 21:30 ` oliver.rosten at googlemail dot com
@ 2023-04-15 21:35 ` pinskia at gcc dot gnu.org
2023-04-15 21:41 ` oliver.rosten at googlemail dot com
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You most likely should report this to Homebrew too:
https://github.com/Homebrew/homebrew-core/issues
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (8 preceding siblings ...)
2023-04-15 21:35 ` pinskia at gcc dot gnu.org
@ 2023-04-15 21:41 ` oliver.rosten at googlemail dot com
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-15 21:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #10 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Can do, but I don't have sufficient understanding to understand why! Can you
kindly explain?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (9 preceding siblings ...)
2023-04-15 21:41 ` oliver.rosten at googlemail dot com
@ 2023-04-15 21:51 ` pinskia at gcc dot gnu.org
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
2023-04-16 7:40 ` oliver.rosten at googlemail dot com
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 21:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Oliver Rosten from comment #10)
> Can do, but I don't have sufficient understanding to understand why! Can you
> kindly explain?
Because that is where you got the GCC you are using from. It is listed in the
configure line:
"--with-bugurl=https://github.com/Homebrew/homebrew-core/issues"
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (10 preceding siblings ...)
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
@ 2023-04-15 21:51 ` pinskia at gcc dot gnu.org
2023-04-16 7:40 ` oliver.rosten at googlemail dot com
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 21:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |UNCONFIRMED
Ever confirmed|1 |0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/109494] inline const variables interfere with source_location
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
` (11 preceding siblings ...)
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
@ 2023-04-16 7:40 ` oliver.rosten at googlemail dot com
12 siblings, 0 replies; 14+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-04-16 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
--- Comment #12 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Yes, I am aware that I homebrewed gcc. What I don't understand is the
extent to which this a homebrew problem and not a gcc problem. Forgive my
ignorance but I would like to understand what submitting this issue to
homebrew implies/achieves. I simply don't have much awareness of the
broader context.
On Sat, 15 Apr 2023 at 22:51, pinskia at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109494
>
> --- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to Oliver Rosten from comment #10)
> > Can do, but I don't have sufficient understanding to understand why! Can
> you
> > kindly explain?
>
> Because that is where you got the GCC you are using from. It is listed in
> the
> configure line:
> "--with-bugurl=https://github.com/Homebrew/homebrew-core/issues"
>
> --
> You are receiving this mail because:
> You reported the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-04-16 7:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 7:25 [Bug c++/109494] New: inline const variables interfere with source_location oliver.rosten at googlemail dot com
2023-04-13 14:29 ` [Bug target/109494] " pinskia at gcc dot gnu.org
2023-04-13 15:26 ` oliver.rosten at googlemail dot com
2023-04-13 15:27 ` oliver.rosten at googlemail dot com
2023-04-14 15:31 ` ppalka at gcc dot gnu.org
2023-04-14 15:45 ` ppalka at gcc dot gnu.org
2023-04-15 21:19 ` oliver.rosten at googlemail dot com
2023-04-15 21:21 ` pinskia at gcc dot gnu.org
2023-04-15 21:30 ` oliver.rosten at googlemail dot com
2023-04-15 21:35 ` pinskia at gcc dot gnu.org
2023-04-15 21:41 ` oliver.rosten at googlemail dot com
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
2023-04-15 21:51 ` pinskia at gcc dot gnu.org
2023-04-16 7:40 ` oliver.rosten at googlemail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).