[Bug middle-end/101217] New: Stray "note" diagnostics when warning suppressed in gcc.dg/analyzer/setjmp-2.c

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 25 21:24:25 GMT 2021


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

            Bug ID: 101217
           Summary: Stray "note" diagnostics when warning suppressed in
                    gcc.dg/analyzer/setjmp-2.c
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: msebor at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573695.html reports

On Linux/x86_64,

e9e2bad7251477db92ab9ebcdc010f9282dd9890 is the first bad commit
commit e9e2bad7251477db92ab9ebcdc010f9282dd9890
Author: Martin Sebor <msebor@redhat.com>
Date:   Thu Jun 24 19:22:06 2021 -0600

    middle-end: add support for per-location warning groups.

caused

FAIL: gcc.dg/analyzer/setjmp-2.c (test for excess errors)

with GCC configured with

../../gcc/configure
--prefix=/local/skpandey/gccwork/toolwork/gcc-bisect-master/master/r12-1805/usr
--enable-clocale=gnu --with-system-zlib --with-demangler-in-ld
--with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl
--enable-libmpx x86_64-linux --disable-bootstrap

To reproduce:

$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="analyzer.exp=gcc.dg/analyzer/setjmp-2.c
--target_board='unix{-m32}'"
$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="analyzer.exp=gcc.dg/analyzer/setjmp-2.c
--target_board='unix{-m32\ -march=cascadelake}'"
$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="analyzer.exp=gcc.dg/analyzer/setjmp-2.c
--target_board='unix{-m64}'"
$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="analyzer.exp=gcc.dg/analyzer/setjmp-2.c
--target_board='unix{-m64\ -march=cascadelake}'"

I can reproduce this without the analyzer via:

$ ./xgcc -B. ../../src/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c  -S
In file included from ../../src/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c:5:
../../src/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c: In function ‘test_1’:
../../src/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h:19:12: note: in a call to
function ‘setjmp’
   19 | extern int setjmp(jmp_buf env);
      |            ^~~~~~
../../src/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c: In function ‘test_3’:
../../src/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h:22:13: note: in a call to
function ‘longjmp’
   22 | extern void longjmp(jmp_buf env, int val);
      |             ^~~~~~~
../../src/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c: In function ‘test_4’:
../../src/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h:22:13: note: in a call to
function ‘longjmp’


Looks like notes are emitted here:

#5  0x0000000000994645 in maybe_warn_rdwr_sizes (rwm=0x7fffffffca60,
fndecl=<function_decl 0x7fffea7a0000 setjmp>, 
    fntype=<function_type 0x7fffea778690>, exp=<call_expr 0x7fffea6514d0>) at
../../src/gcc/calls.c:2231
2231            inform (DECL_SOURCE_LOCATION (fndecl),
(gdb) list
2226                    fntype, attrstr);
2227        }
2228      else if (opt_warned != N_OPTS)
2229        {
2230          if (fndecl)
2231            inform (DECL_SOURCE_LOCATION (fndecl),
2232                    "in a call to function %qD", fndecl);

Looks like something's wrong with the way this interacts with the
TREE_NO_WARNING rewrite.


More information about the Gcc-bugs mailing list