[Bug tree-optimization/103121] [12 Regression] Warnings in cp/optimize.c causing build failure

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 8 20:48:50 GMT 2021


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

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
Sorry, I've been having trouble with GDB and so I'm running two GDB sessions
and I have been mixing output from both of them.  I see the warning for the
store to *_23 in BB 13, not for BB 12.  Here's a fresh session as a sanity
check:

$ /build/hppa-unknown-linux-gnu/gcc-master/gcc/xgcc -B
/build/hppa-unknown-linux-gnu/gcc-master/gcc -O2 -S -Wall
-fdump-tree-strlen-details pr103121.ii -wrapper gdb,--args
GNU gdb (GDB) 11.1
...
(gdb) b tree-ssa-strlen.c:2181
Breakpoint 1 at 0x192caed: file /src/gcc/master/gcc/tree-ssa-strlen.c, line
2181.
(gdb) r
Starting program: /ssd/build/hppa-unknown-linux-gnu/gcc-master/gcc/cc1plus
-fpreprocessed pr103121.ii -quiet -dumpbase pr103121.ii -dumpbase-ext .ii -O2
-Wall -fdump-tree-strlen-details -o pr103121.s

Breakpoint 1, strlen_pass::maybe_warn_overflow (this=0x7fffffffd880,
stmt=0x7ffff4de2730, call_lhs=true, len=1, si=0x0, plus_one=false,
rawmem=false) at /src/gcc/master/gcc/tree-ssa-strlen.c:2181
2181      tree tlen = build_int_cst (size_type_node, len);
(gdb) p debug(gimple_bb(stmt))
<bb 12> [local count: 12992276]:
*grp_name_37 = 0;
goto <bb 14>; [100.00%]

$1 = void
(gdb) c
Continuing.

Breakpoint 1, strlen_pass::maybe_warn_overflow (this=0x7fffffffd880,
stmt=0x7ffff4c2ea00, call_lhs=true, len=1, si=0x0, plus_one=false,
rawmem=false) at /src/gcc/master/gcc/tree-ssa-strlen.c:2181
2181      tree tlen = build_int_cst (size_type_node, len);
(gdb) p debug(gimple_bb(stmt))
<bb 10> [local count: 630715945]:
MEM[(char *)grp_name_37 + idx_58 * 1] = 53;

$2 = void
(gdb) c
Continuing.

Breakpoint 1, strlen_pass::maybe_warn_overflow (this=0x7fffffffd880,
stmt=0x7ffff4c2eb40, call_lhs=true, len=1, si=0x0, plus_one=false,
rawmem=false) at /src/gcc/master/gcc/tree-ssa-strlen.c:2181
2181      tree tlen = build_int_cst (size_type_node, len);
(gdb) p debug(gimple_bb(stmt))
<bb 13> [local count: 105119324]:
_23 = grp_name_37 + idx_47;
*_23 = 0;
if (diff_seen_24 != 0)
  goto <bb 15>; [100.00%]
else
  goto <bb 14>; [0.00%]

$3 = void
(gdb) c
Continuing.
../../gcc/gcc/cp/optimize.c: In function 'tree_node* cdtor_comdat_group(tree,
tree)':
../../gcc/gcc/cp/optimize.c:208:17: warning: writing 1 byte into a region of
size 0 [-Wstringop-overflow=]
../../gcc/gcc/cp/optimize.c:191:40: note: at offset 1 into destination object
of size 1 allocated by '__builtin_alloca'
[Inferior 1 (process 11409) exited normally]


More information about the Gcc-bugs mailing list