public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/107936] New: #pragma GCC diagnostic ignored vs. LTO
@ 2022-11-30 16:01 jakub at gcc dot gnu.org
  2022-11-30 16:41 ` [Bug lto/107936] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-11-30 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107936
           Summary: #pragma GCC diagnostic ignored vs. LTO
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

rh1948567-1.c:
void foo (char x[2]);

int
main ()
{
  char x[2];
#pragma GCC diagnostic ignored "-Wstringop-overflow"
  foo (x + 1);
}
rh1948567-2.c:
void
foo (char x[2])
{
  asm volatile ("" : : "r" (&x[0]) : "memory");
}
gcc -W -Wall -flto -o rh1948567{,-1.c,-2.c}
rh1948567-1.c: In function ‘main’:
rh1948567-1.c:8:3: warning: ‘foo’ accessing 2 bytes in a region of size 1
[-Wstringop-overflow=]
    8 |   foo (x + 1);
      |   ^
rh1948567-1.c:8:3: note: referencing argument 1 of type ‘char[2]’
rh1948567-2.c:2:1: note: in a call to function ‘foo’
    2 | foo (char x[2])
      | ^

Shouldn't the diagnostic pragma prevent the warning even in the LTO case?

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

* [Bug lto/107936] #pragma GCC diagnostic ignored vs. LTO
  2022-11-30 16:01 [Bug lto/107936] New: #pragma GCC diagnostic ignored vs. LTO jakub at gcc dot gnu.org
@ 2022-11-30 16:41 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-30

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #0)
> Shouldn't the diagnostic pragma prevent the warning even in the LTO case?

Yes but I don't think it is streamed out. See PR 80922 (and a few others in the
see also).

Confirmed.

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

end of thread, other threads:[~2022-11-30 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 16:01 [Bug lto/107936] New: #pragma GCC diagnostic ignored vs. LTO jakub at gcc dot gnu.org
2022-11-30 16:41 ` [Bug lto/107936] " pinskia 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).