https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81668
--- Comment #7 from sgunderson at bigfoot dot com --- (In reply to Manuel López-Ibáñez from comment #6) >> fts0pars.y:62:0: note: a field with different name is defined in another >> translation unit > Did you cut the above? It looks like a note without a previous warning. > Also, GCC will have trouble to point out the correct location when compiling > a generated file that contains linemarkers, unless the linemarkers exactly > point out to the original file AND the original file is available to read. Sorry, yes, it was cut (I didn't intend to include it, as it is related to another and very real warning). Let me make a more minimal example to illustrate my issue (adapted from the case in 81716). I thought I'd pasted it already, but evidently it never made Bugzilla. atum17:~> cat test1.cc #include "test.h" void foo(S *t) { q[0] = nullptr; } atum17:~> cat test2.cc #include <stdio.h> #include "test.h" class S { int m; }; void bar(S *t) { printf("%p\n", q[0]); } atum17:~> cat test.h class S; extern S *q[10]; atum17:~> /usr/lib/gcc-snapshot/bin/g++ -Wall -O2 -flto -o test.so test1.cc test2.cc test.h:2:11: warning: type of 'q' does not match original declaration [-Wlto-type-mismatch] extern S *q[10]; ^ test.h:2:11: note: 'q' was previously declared here extern S *q[10]; ^ test.h:2:11: note: code may be misoptimized unless -fno-strict-aliasing is used /usr/lib/x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status What I'd like is some sort of indication about where test.h came in from (test1.cc and test2.cc).