[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-18 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org ---

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-17 Thread normvcr at telus dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 --- Comment #6 from Norman Goldstein --- Thank you for that. I hadn't realized there was a -flto flag. It, indeed, does warn for the mismatched types. The flag also causes the notice note: code may be misoptimized unless

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 --- Comment #5 from Jonathan Wakely --- (In reply to Norman Goldstein from comment #4) > This makes sense. Would it be a reasonable option to have the linker check > for such mismatches? As Andrew already said, it can only be done with LTO,

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-16 Thread normvcr at telus dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 --- Comment #4 from Norman Goldstein --- I've received an explanation from bug-gnu-ut...@gnu.org. The C++11 standard 3.5/10 states that "... the types specified by all declarations referring to a given variable or function shall be identical

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-05 Thread normvcr at telus dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 --- Comment #3 from Norman Goldstein --- The 2nd reference https://en.cppreference.com/w/cpp/language/definition differentiates between a bare "extern" statement, and an initializing extern statement. The former is a declaration, but not a

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 --- Comment #2 from Jonathan Wakely --- (In reply to Norman Goldstein from comment #0) > The type of "foo" is different in the two files: Yes, you've violated the C++ One-Definition Rule, which means your program is ill-formed, but the

[Bug c++/93585] Linker resolves variable with extern variable of same name but different type

2020-02-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---