[Bug regression/37824] funroll-loops miscompiles php

2008-10-14 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2008-10-14 13:20 ---
It is indeed an aliasing violation, you store a long and read a long*.

Fix it like

int main()
{
int i;
long a;
long **b = malloc(8 * sizeof(long));

for (i = 0; i  8; i++)
*b++ = a;

b--;
foo(6, (void **)b);


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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



[Bug regression/37824] funroll-loops miscompiles php

2008-10-14 Thread anton at samba dot org


--- Comment #1 from anton at samba dot org  2008-10-14 11:59 ---
Alan Modra points out the cast is not required and removing it does fix the
issue.

BTW -Wstrict-aliasing (or -Wstrict-aliasing=2) doesn't warn about the code.


-- 


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



[Bug regression/37824] funroll-loops miscompiles php

2008-10-14 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2008-10-14 21:59 ---
There are two aliasing violations here.
The first is what Richard mentioned and the second is also in foo, there is a
load from p via long* and also a store via void*.  That is where the issue
comes down to here and not the other one but both are undefined code .


-- 


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