public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
@ 2022-10-25 17:00 seurer at gcc dot gnu.org
  2022-10-27 23:23 ` [Bug analyzer/107396] [13 " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: seurer at gcc dot gnu.org @ 2022-10-25 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107396
           Summary: [12 regression] new test case
                    gcc.dg/analyzer/pipe-glibc.c in
                    r13-3466-g792f039fc37faa fails with excess errors
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:792f039fc37faa3446725a643c8018f084e8ccab, r13-3466-g792f039fc37faa
make  -k check-gcc RUNTESTFLAGS="analyzer.exp=gcc.dg/analyzer/pipe-glibc.c"
FAIL: gcc.dg/analyzer/pipe-glibc.c (test for excess errors)
# of unexpected failures        1


I am only seeing this failure on power 9.  It works fine on power 8 and power
10.


commit 792f039fc37faa3446725a643c8018f084e8ccab (HEAD, refs/bisect/bad)
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Mon Oct 24 16:38:22 2022 -0400

    analyzer: handle "pipe" and "pipe2" [PR106300]

spawn -ignore SIGHUP /home/seurer/gcc/git/build/gcc-test/gcc/xgcc
-B/home/seurer/gcc/git/build/gcc-test/gcc/
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
-fdiagnostics-plain-output -fanalyzer -Wanalyzer-too-complex
-fanalyzer-call-summaries -S -o pipe-glibc.s^M
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c: In
function 'write_to_pipe':^M
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3:
warning: use of possibly-NULL 'stream' where non-null expected [CWE-690]
[-Wanalyzer-possible-null-argument]^M
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:27:12:
note: (1) this call could return NULL^M
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3:
note: (2) argument 4 ('stream') from (1) could be NULL where non-null
expected^M
<built-in>: note: argument 4 of '__builtin_fwrite' must be non-null^M
FAIL: gcc.dg/analyzer/pipe-glibc.c (test for excess errors)
Excess errors:
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3:
warning: use of possibly-NULL 'stream' where non-null expected [CWE-690]
[-Wanalyzer-possible-null-argument]

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
@ 2022-10-27 23:23 ` pinskia at gcc dot gnu.org
  2022-10-28 11:12 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-27 23:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107446 has been marked as a duplicate of this bug. ***

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
  2022-10-27 23:23 ` [Bug analyzer/107396] [13 " pinskia at gcc dot gnu.org
@ 2022-10-28 11:12 ` rguenth at gcc dot gnu.org
  2022-12-02 10:13 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-28 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
  2022-10-27 23:23 ` [Bug analyzer/107396] [13 " pinskia at gcc dot gnu.org
  2022-10-28 11:12 ` rguenth at gcc dot gnu.org
@ 2022-12-02 10:13 ` marxin at gcc dot gnu.org
  2023-01-13 11:35 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-02 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-12-02
             Status|UNCONFIRMED                 |ASSIGNED
              Build|powerpc64le-linux-gnu       |powerpc64le-linux-gnu,
                   |                            |x86_64-linux-gnu
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
             Target|powerpc64le-linux-gnu       |powerpc64le-linux-gnu,
                   |                            |x86_64-linux-gnu
               Host|powerpc64le-linux-gnu       |powerpc64le-linux-gnu,
                   |                            |x86_64-linux-gnu

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-12-02 10:13 ` marxin at gcc dot gnu.org
@ 2023-01-13 11:35 ` rguenth at gcc dot gnu.org
  2023-02-14  8:27 ` linkw at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-13 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-13 11:35 ` rguenth at gcc dot gnu.org
@ 2023-02-14  8:27 ` linkw at gcc dot gnu.org
  2023-03-15  9:47 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-02-14  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
*** Bug 108726 has been marked as a duplicate of this bug. ***

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-02-14  8:27 ` linkw at gcc dot gnu.org
@ 2023-03-15  9:47 ` rguenth at gcc dot gnu.org
  2023-03-15 14:33 ` dave.anglin at bell dot net
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-15  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The diagnostic is correct I think - I wonder why I do not see it on
x86_64-linux.  It probably depends on the glibc version (I have 2.31)

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-03-15  9:47 ` rguenth at gcc dot gnu.org
@ 2023-03-15 14:33 ` dave.anglin at bell dot net
  2023-03-29 17:16 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dave.anglin at bell dot net @ 2023-03-15 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from dave.anglin at bell dot net ---
I currently have 2.36.

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-03-15 14:33 ` dave.anglin at bell dot net
@ 2023-03-29 17:16 ` jakub at gcc dot gnu.org
  2023-03-31 20:49 ` cvs-commit at gcc dot gnu.org
  2023-03-31 20:54 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-29 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the difference is
https://sourceware.org/git/?p=glibc.git;a=commit;h=c1760eaf3b575ad174fd88b252fd16bd525fa818
which added __attribute__((malloc)) to fdopen among other things.
It is strange that it is reported just for fwrite and not for fgetc in the
other function though, both access potentially NULL stream.
Probably because {fwrite,putc,fputc,fputs}{,_unlocked} and printf family are
builtins and have nonnull attribute for the FILE * argument, but fgetc or fread
is not and glibc
doesn't use nonnull for those.

Shall we than use
2023-03-29  Jakub Jelinek  <jakub@redhat.com>

        PR analyzer/107396
        * gcc.dg/analyzer/pipe-glibc.c (read_from_pie, write_to_pipe): Exit
        if fdopen returns NULL.

--- gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c.jj       2022-10-25
10:37:28.106531709 +0200
+++ gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c  2023-03-29 19:14:48.789766475
+0200
@@ -13,6 +13,8 @@ read_from_pipe (int file)
   FILE *stream;
   int c;
   stream = fdopen (file, "r");
+  if (stream == NULL)
+    exit (EXIT_FAILURE);
   while ((c = fgetc (stream)) != EOF)
     putchar (c);
   fclose (stream);
@@ -25,6 +27,8 @@ write_to_pipe (int file)
 {
   FILE *stream;
   stream = fdopen (file, "w");
+  if (stream == NULL)
+    exit (EXIT_FAILURE);
   fprintf (stream, "hello, world!\n");
   fprintf (stream, "goodbye, world!\n");
   fclose (stream);
because this warning is not what the test wants to verify?

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-03-29 17:16 ` jakub at gcc dot gnu.org
@ 2023-03-31 20:49 ` cvs-commit at gcc dot gnu.org
  2023-03-31 20:54 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-31 20:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:92f02e754ca2fbcd56dbd7b3949147d50bab99a0

commit r13-6961-g92f02e754ca2fbcd56dbd7b3949147d50bab99a0
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 31 22:48:44 2023 +0200

    testsuite, analyzer: Fix up pipe-glibc.c testcase [PR107396]

    The gcc.dg/analyzer/pipe-glibc.c test FAILs when using recent glibc headers
    and succeeds with older headers.
    The important change is that
   
https://sourceware.org/git/?p=glibc.git;a=commit;h=c1760eaf3b575ad174fd88b252fd16bd525fa818
    in 2021 added __attribute__ ((__malloc__ (fclose, 1))) attribute to fdopen,
    so in write_to_pipe there is an excess warning:
    .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c: In function
'write_to_pipe':
    .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: warning: use of
possibly-NULL 'stream' where non-null expected [CWE-690]
[-Wanalyzer-possible-null-argument]
    .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:27:12: note: (1) this call
could return NULL
    .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: note: (2) argument 4
('stream') from (1) could be NULL where non-null expected
    <built-in>: note: argument 4 of '__builtin_fwrite' must be non-null
    Strangely, nothing is reported on the read_from_pipe function, seems
    fwrite/fprintf/fputc etc. are builtins in GCC and we mark the FILE *
    arguments as nonnull there on the builtin declarations, while fgetc/fread
    etc. aren't builtins and glibc doesn't mark any of those using nonnull.
    Shall we change that on the glibc side?

    Anyway, because this differs based on glibc version and I think the
    above warning is not the primary intention of the test, I think it is
    best to tweak it so that this warning isn't reported.
    Another option would be avoid using glibc headers and use our own
    declarations, or make sure we add the malloc with fclose attribute
ourselves
    (but fdopen in the libc headers could be a macro, so not sure
    __typeof (fdopen) fdopen __attribute__ ((__malloc__, __malloc__ (fclose,
1)));
    would work).  Or use -Wno-analyzer-possible-null-arguments in
    dg-additional-options?

    2023-03-31  Jakub Jelinek  <jakub@redhat.com>

            PR analyzer/107396
            * gcc.dg/analyzer/pipe-glibc.c (read_from_pie, write_to_pipe): Exit
            if fdopen returns NULL.

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

* [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors
  2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-03-31 20:49 ` cvs-commit at gcc dot gnu.org
@ 2023-03-31 20:54 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-31 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-03-31 20:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 17:00 [Bug target/107396] New: [12 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors seurer at gcc dot gnu.org
2022-10-27 23:23 ` [Bug analyzer/107396] [13 " pinskia at gcc dot gnu.org
2022-10-28 11:12 ` rguenth at gcc dot gnu.org
2022-12-02 10:13 ` marxin at gcc dot gnu.org
2023-01-13 11:35 ` rguenth at gcc dot gnu.org
2023-02-14  8:27 ` linkw at gcc dot gnu.org
2023-03-15  9:47 ` rguenth at gcc dot gnu.org
2023-03-15 14:33 ` dave.anglin at bell dot net
2023-03-29 17:16 ` jakub at gcc dot gnu.org
2023-03-31 20:49 ` cvs-commit at gcc dot gnu.org
2023-03-31 20:54 ` jakub 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).