https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98512
Bug ID: 98512 Summary: “#pragma GCC diagnostic ignored” ineffective in conjunction with alias attribute Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: fw at gcc dot gnu.org CC: msebor at gcc dot gnu.org Target Milestone: --- The following test case has been extracted from a glibc build failure on powerpc64le, but it appears to be target-independent. This produces a -WWstringop-overread warning at -O2, even though the warning has been suppressed. void * __rawmemchr_ppc (const void *s, int c) { #pragma GCC diagnostics push #pragma GCC diagnostic ignored "-Wstringop-overflow=" #pragma GCC diagnostic ignored "-Wstringop-overread" if (c != 0) return __builtin_memchr (s, c, (unsigned long)-1); #pragma GCC diagnostics pop return (char *)s + __builtin_strlen (s); } extern __typeof (__rawmemchr_ppc) __EI___rawmemchr_ppc __attribute__((alias ("__rawmemchr_ppc"))); t.c:8:12: warning: ‘__builtin_memchr’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overread] 8 | return __builtin_memchr (s, c, (unsigned long)-1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Seen with: 11.0.0 20210104 (experimental)