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++/69487] Unexpected VLA initialization of char[] from ""


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-01-26
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The dumped trees show a memcpy from "" with the length as the length of the
array:

  __builtin_memcpy (buffer.1_23, "", _15);

That should presumably use strnlen("", _15 - 1) or just be consistent with the
C front-end and reject it:

vla.c:20:5: error: variable-sized object may not be initialized

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