This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/84046] [6/7/8 Regression] global zero-sized objects may have same address
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Jan 2018 16:08:22 +0000
- Subject: [Bug c/84046] [6/7/8 Regression] global zero-sized objects may have same address
- Auto-submitted: auto-generated
- References: <bug-84046-4@http.gcc.gnu.org/bugzilla/>
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).