[Bug c++/93585] Linker resolves variable with extern variable of same name but different type
normvcr at telus dot net
gcc-bugzilla@gcc.gnu.org
Mon Feb 17 19:21:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #6 from Norman Goldstein <normvcr at telus dot net> ---
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 ‘-fno-strict-aliasing’ is used
Perhaps an oversight, the above notice is emitted even when I do include the
no-strict-aliasing flag:
gcc -fno-strict-aliasing -o tlink tlink.cpp tlink2.cpp -flto -lstdc++
I really like the -flto option. Mismatched types could be otherwise hard to
track down.
More information about the Gcc-bugs
mailing list