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

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 2 Nov 2016, krister.walfridsson at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78035
> 
> krister.walfridsson at gmail dot com changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |krister.walfridsson at gmail 
> dot c
>                    |                            |om
> 
> --- Comment #9 from krister.walfridsson at gmail dot com ---
> Doesn't this just introduce more inconsistencies in the compiler? For example
> 
>     extern int a;
>     extern int b;
> 
>     int foo(void)
>     {
>         a = 1;
>         b = 5;
>         a++;
>         return &a != &b;
>     }
> 
> optimizes to
> 
>     foo:
>         movl    $a, %eax
>         movl    $5, b(%rip)
>         movl    $2, a(%rip)
>         cmpq    $b, %rax
>         setne   %al
>         movzbl  %al, %eax
>         ret
> 
> That is, the accesses to a and b are optimized as if they are distinct, even
> though the compiler keeps the comparison of the addresses.
> 
> I cannot think of a reasonable use case where you must handle comparisons of
> the addresses as currently implemented while allowing other optimizations as 
> if
> the objects are distinct, so I'd say the bug from the original description is
> that we were "being too conservative in bar"...

I opened this bug for the inconsistency in address comparisons which
now can utilize points-to analysis.  This part is fixed now.

Yes, for alias analysis we are less conservative than when optimizing
address comparisons ... but it appears that this is on purpose.

Reply via email to