On Tue, Nov 15, 2016 at 10:47 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Can you verify that a TU compiled with -fstrict-aliasing will link as >> if -fno-strict-aliasing if -fno-strict-aliasing is specified at link time? > > Yes, it does: > > eric@polaris:~/build/gcc/native> ~/install/gcc/bin/gcc -c t.c -O2 -flto > eric@polaris:~/build/gcc/native> ~/install/gcc/bin/gcc -o t t.o -O2 -save- > temps -fverbose-asm && grep strict-aliasing t.ltrans0.s > # -fstore-merging -fstrict-aliasing -fstrict-overflow > eric@polaris:~/build/gcc/native> ~/install/gcc/bin/gcc -o t t.o -O2 -fno- > strict-aliasing -save-temps -fverbose-asm && grep strict-aliasing t.ltrans0.s > # -fno-strict-aliasing -fverbose-asm -fltrans t.ltrans0.o
Yes, I know -fno-strict-aliasing is globally set, but will all -fstrict-aliasing optimization attributes on functions be "overwritten"? That is, are you sure that when optimizing a function originally compiled with -fstrict-aliasing that -fno-strict-aliasing is in effect? >> That said, -Wno-lto-type-mismatch can be used to disable the warning as >> well. > > Right, but the wording ("code may be misoptimized") is a bit scaring so I'd > rather avoid it when possible. > > -- > Eric Botcazou