This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49330] Integer arithmetic on addresses optimised with pointer arithmetic rules
- From: "harald at gigawatt dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 8 Jun 2011 20:42:07 +0000
- Subject: [Bug c/49330] Integer arithmetic on addresses optimised with pointer arithmetic rules
- Auto-submitted: auto-generated
- References: <bug-49330-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49330
--- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> 2011-06-08 20:42:04 UTC ---
A similar example, but one which does not convert the integer back to a
pointer:
#include <stdio.h>
#include <stdlib.h>
int a;
int main() {
unsigned long b = (unsigned long) &a - 134518548;
volatile unsigned long c = b;
if (c == 0) {
if (b != 0) abort ();
}
printf("%lu\n", c);
return a;
}
This should never abort. It aborts on my system (with -m32).