This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65679] New: Too strict alias analysis?
- From: "gcc at robbertkrebbers dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Apr 2015 18:22:59 +0000
- Subject: [Bug c/65679] New: Too strict alias analysis?
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65679
Bug ID: 65679
Summary: Too strict alias analysis?
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc at robbertkrebbers dot nl
Consider the following example:
#include<stdio.h>
#include<stdint.h>
int main() {
int x = 1, y = 2, *p = &y, *q = &x + 1;
if ((intptr_t)p == (intptr_t)q) {
*q = 10;
printf("%d %d %d\n", x, y, p == q);
}
}
When compiled with "gcc -pedantic -std=c99 -O2" (and even with
-fno-strict-aliasing added), the compiled program prints:
1 2 0
So, despite the fact that is has been "observed" that p and q have identical
representations, they are still not being treated as equal.
Is this intended?