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 tree-optimization/78035] Inconsistency between address comparison and alias analysis


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"...

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