https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94150
Bug ID: 94150 Summary: Improve LTO diagnosis for LTO triggered warnings/error: print source.o or source.a(lib.o) when printing location Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: romain.geissler at amadeus dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Hi, When LTO warnings/error are reported and print a given location, it would be nice to not only print the C/C++ file name, but also from which .o or .a library it comes from. Example of -Werror=lto-type-mistmatch I just got because I was mixing incompatible .o built against different version of the same header file "toolbox/UTF8Utils.h": /remote/intdeliv/components/mdw/Toolbox/18-0-0-56/include/toolbox/UTF8Utils.h:106: error: type of ‘operator[]’ does not match original declaration [-Werror=lto-type-mismatch] char operator[] (size_t x); src/UTF8Utils.cpp:148: note: implicit this pointer type mismatch include/toolbox/UTF8Utils.h:23: note: type ‘struct UTF8Char’ itself violates the C++ One Definition Rule /remote/tmp/rnd-aqg/software_factory/bms_replication/mdw/Toolbox/18-0-0-48/include/toolbox/UTF8Utils.h:22: note: the incompatible type is defined here class TOOLBOX_EXPORT UTF8Char src/UTF8Utils.cpp:148: note: ‘operator[]’ was previously declared here src/UTF8Utils.cpp:148: note: code may be misoptimized unless -fno-strict-aliasing is used The problem here is that I mixed our own version of a library named "Toolbox" from version 18-0-0-56 and 18-0-0-48 which are incompatible. I need to rebuild the .o which is using version 18-0-0-48 as given in the error, however I have no idea which libraries is that, and I have hundreds of them, which unfortunately I can't rebuild massively easily. So if the location in LTO mode could print something like: /path/to/wrong/lib.a(name_of_o_file.o):/remote/tmp/rnd-aqg/software_factory/bms_replication/mdw/Toolbox/18-0-0-48/include/toolbox/UTF8Utils.h:22: note: the incompatible type is defined here class TOOLBOX_EXPORT UTF8Char that would help identifying which files need rebuilding. Cheers, Romain