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++/51731] code generation bug in negative indices in arrays on 64-bit targets


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51731

--- Comment #4 from M.L. Hekkelman <m.hekkelman at cmbi dot ru.nl> 2012-01-02 19:08:10 UTC ---
Beste jakub,

maandag 2 januari 2012, 18:10:17, schreef je:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51731

> Jakub Jelinek <jakub at gcc dot gnu.org> changed:

>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |RESOLVED
>                  CC|                            |jakub at gcc dot gnu.org
>          Resolution|                            |INVALID

> --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-02 17:10:17 UTC ---
> Having a zero-sized array at the end of a struct is surely a commonly used
> technique, close to standard flexible array members, but that is not what you
> are doing.  Trying to reference data.e[-1] through data.e[-9] is of course not
> valid C++ (nor C) when e is an array (it might be valid if e was a pointer and
> pointed into the middle of some array).

Following your logic, if I rewrite the code from:

  return data.e[-1];

to

  int* ep = data.e;
  return ep[-1];

It  would  be  valid,  right? And you still believe the bug report is 
invalid?


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