https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69254

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 37435
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37435&action=edit
gcc6-pr69254-wip.patch

WIP patch.  This handles the merging of the -fsanitize=/-fno-sanitize= options
from the various TUs, except for the first TU (we don't call merge_and_complain
for that, so right now it just passes through all the
-fsanitize=/-fno-sanitize=, which is undesirable, it should do what
merge_and_complain does with those options and remove the others).  Perhaps
merge_and_complain should be called in all cases, and for the first file be
told by some bool arg it is the first one.

But, before handling that, I see much bigger problem, and it is not only
related to -fsanitize=, but to various other options.
The thing is that the linker options are appended after the options derived
from the TUs.  If I say have a TU that has some OpenMP code in it and compile
it with -c -flto -fopenmp, and then link with -flto or -flto -fopenmp, it works
fine, but if I link with -flto -fno-openmp, I get very similar ICE to this PR.
So clearly there are some options that should at least in some cases override
even the linker options/

Reply via email to