public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug pch/112747] New: #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers.
@ 2023-11-28 16:15 piannetta at kalrayinc dot com
  2023-11-28 17:12 ` [Bug pch/112747] " lhyatt at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: piannetta at kalrayinc dot com @ 2023-11-28 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112747
           Summary: #pragma GCC diagnostic ignored "-Wstringop-overflow"
                    has no effect in pre-compiled headers.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: pch
          Assignee: unassigned at gcc dot gnu.org
          Reporter: piannetta at kalrayinc dot com
  Target Milestone: ---

==> t.c <==
#include "t.h"

extern char a[10];

int g ()
{
  return f(a, 11, 1);
}

==> t.h <==
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
static char f (char *a, int idx, char v) { return a[idx] = v; }
#pragma GCC diagnostic pop

=====================================

$ gcc t.c -O2 -c
$ gcc t.h -O2
$ gcc t.c -O2
In function 'f',
    inlined from 'g' at t.c:8:10:
t.h:3:58: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
t.c: In function 'g':
t.c:4:13: note: at offset 11 into destination object 'a' of size 10

=====================================

-Wstringop-overflow is not ignored as it ought to be when a pre-compiled header
exists. This cause the test
gcc/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc
from libstdc++v3 to fail.

I can reproduce the bug on gcc12, gcc13, gcc14 and trunk.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug pch/112747] #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers.
  2023-11-28 16:15 [Bug pch/112747] New: #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers piannetta at kalrayinc dot com
@ 2023-11-28 17:12 ` lhyatt at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-11-28 17:12 UTC (permalink / raw)
  To: gcc-bugs

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

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Thanks, it is PR 64117; the patch waiting for review there will fix it.

*** This bug has been marked as a duplicate of bug 64117 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-28 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 16:15 [Bug pch/112747] New: #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers piannetta at kalrayinc dot com
2023-11-28 17:12 ` [Bug pch/112747] " lhyatt at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).