This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ODR violation warning when compiling with -flto -fno-semantic-interposition -fPIC


> I can't reproduce it on x86_64-linux-gnu.  What is your architecture?

Ups, I forgot to mention one more flag "-O" which is important here.

So building instructions should be like this with the same code:

$ g++ -c 1.cpp -O -flto -fno-semantic-interposition -fPIC
$ g++ -c 2.cpp -O -flto -fno-semantic-interposition -fPIC
$ g++ 1.o 2.o

I tried this on two PCs, both x86_64-linux-gnu (Ubuntu and NixOS), on
both of them it produces the warning.

I also just found out that it compiles fine on gcc5 (5.4.1 20160904).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]