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

sandra at gcc dot gnu.org changed:

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

--- Comment #11 from sandra at gcc dot gnu.org ---
The new testcase is failing on nios2-elf.

$ nios2-elf-g++  src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C
-O2 -fdump-tree-optimized -S -Wall
In constructor 'S::S(int)',
    inlined from 'void __static_initialization_and_destruction_0(int, int)' at
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:26:7,
    inlined from '(static initializers for
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C)' at
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:26:8:
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7: warning:
array subscript [0, 536870911] is outside array bounds of 'void [0]'
[-Warray-bounds]
   22 |       new (p + i) int ();
      |       ^~~~~~~~~~~~~~~~~~
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:19:51: note:
object of size 0 allocated by 'operator new []'
   19 |     p = (int*) new unsigned char [sizeof (int) * m];
      |                                                   ^


This is what I see in the .optimized dump file:

;; Function _GLOBAL__sub_I_a (_GLOBAL__sub_I_a, funcdef_no=5, decl_uid=1975,
cgraph_uid=6, symbol_order=6) (executed once)

Removing basic block 5
void _GLOBAL__sub_I_a ()
{
  int _2;
  void * _5;
  sizetype _12;
  sizetype _20;

  <bb 2> [local count: 1073741824]:
  a ={v} {CLOBBER};
  a.m = 0;
  _5 = operator new [] (0);
  a.p = _5;
  _2 = a.m;
  if (_2 > 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 955630224]:
  _20 = (sizetype) _2;
  _12 = _20 * 4;
  __builtin_memset (_5, 0, _12); [tail call]

  <bb 4> [local count: 1073741825]:
  return;

}

Reply via email to