[Bug c/84046] [6/7/8 Regression] global zero-sized objects may have same address

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 26 16:08:00 GMT 2018


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Zero sized objects of course can have the same address and always had.
Just in your testcase the comparison used to be optimized away before r218462.
If you hide it from the optimizers, like with:
        int *p = a;
        int *q = b;
        asm ("" : "+r" (p), "+r" (q));
        if(p == q) __builtin_abort ();
you'll get aborts all the way to r104500 (oldest revision I have around).


More information about the Gcc-bugs mailing list