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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #11)
> Note for func2 we get:
> 
>   if (flag.0_2 != 0)
>     goto <bb 4>; [50.00%]
>   else
>     goto <bb 3>; [50.00%]
> 
>   <bb 3> [local count: 536870912]:
>   pretmp_18 = *a_10(D);
>   pretmp_20 = MEM[(int *)a_10(D) + 4B];
>   goto <bb 5>; [100.00%]
> 
>   <bb 4> [local count: 536870913]:
>   *a_10(D) = _9;
>   MEM[(int *)a_10(D) + 4B] = _1;
> 
>   <bb 5> [local count: 1073741824]:
>   # prephitmp_19 = PHI <pretmp_18(3), _9(4)>
>   # prephitmp_21 = PHI <pretmp_20(3), _1(4)>
> 
> the conditional stores are correct if not supplying -fallow-store-data-races
> .  Now GCC does not optimize this even with -fallow-store-data-races but
> maybe it could.


So looking into this again, it can't because if a is pointing to read only
memory and doing a store to it when `!flag` would cause a crash.

So there is nothing to be done here so closing as invalid for func2

Reply via email to