https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212
Bug ID: 84212 Summary: -Wno-* does not disable warnings from -flto link stage Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: jay.foad at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- See example below: I'm getting warnings emitted by the -flto link stage. I'd like to selectively disable these warnings in my build scripts, but the usual -Wno-* option doesn't seem to have any effect. (I know the warning is justified in this simple example. But in my real proprietary application code I'm getting false positive warnings from the lto link stage that I'd really like to be able to disable.) $ gcc --version gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat a.c #include <string.h> void a(char * x, int n) { memset(x, 0, n); } $ cat b.c void a(char *, int); int main() { char x[3]; a(x, 4); } $ gcc -O3 -flto -c a.c b.c -Wno-stringop-overflow $ gcc -O3 -flto a.o b.o -Wno-stringop-overflow In function ‘memset’, inlined from ‘main’ at a.c:3:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:10: warning: ‘__builtin___memset_chk’ writing 4 bytes into a region of size 3 overflows the destination [-Wstringop-overflow=] return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); ^