This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69220] Internal error with array of negative size and initializers for it


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |compile-time-hog
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-01-11
      Known to work|                            |6.0
     Ever confirmed|0                           |1
      Known to fail|                            |5.3.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
On trunk:

> /abuild/rguenther/trunk3-g/gcc/cc1plus -quiet t.C -std=c++11t.C: In function âint main()â:
t.C:3:28: error: size of array is negative
      int* p = new int[-1]{1};
                            ^

confirmed for GCC 5 where it loops in

#0  process_init_constructor_array (type=0x7ffff69e3bd0, init=0x7ffff69ebee8, 
    complain=3) at /space/rguenther/src/svn/gcc-5-branch/gcc/cp/typeck2.c:1295

1291        for (; i < len; ++i)

(gdb) p len
$2 = 18446744073709551615
(gdb) p i
$3 = 271414772


I suspect that

  int *p = new int[184467440737095LL]{1};

might also take quite some time due to the loop not exiting early.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]