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

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> (In reply to Andi Kleen from comment #9)
> > Any progress on fixing the test case, so that this can be finally fixed?
> 
> I have no idea how to do that without making the testcase test sth different.
> We could of course simply turn off SRA for it ...
> 
> That said, the difference the optimization may cause might be surprising to
> people.  That is, that the following may abort()
> 
> struct f { char c; int i; };
> struct f2 { int i; int j; };
> int main()
> {
>   struct f f;
>   struct f2 f2;
>   memset(&f, 0, sizeof (f));
>   memcpy(&f2, f, sizeof (f));
>   if (memcmp (&f, &f2) != 0)
>    abort ();
>   return 0;
> }

So the above was mostly handled with r7-5443-g7b45d0dfeb5f85 (and improved
r15-3544-g2067df800df930 which allows the use of memset earlier).

Note the original testcase was "fixed" in GCC 5. Though There might be others
where still are issues.

Reply via email to