This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/49330] Integer arithmetic on addresses optimised with pointer arithmetic rules
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2011 09:50:32 +0000
- Subject: [Bug rtl-optimization/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 #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-06-10 09:50:28 UTC ---
The alias.c machinery is clearly based on the fundamental assumption of pointer
arithmetics, i.e. that you aren't allowed to compute a difference unless both
pointers point to the same enclosing object. The testcase is a nice attempt at
smuggling the violation of this rule behind a uintptr_t based manipulation.
Not clear what to do IMO. Richard is proposing to leverage the escape sites:
px_1 = (uintptr_t) &x;
py_2 = (uintptr_t) &y;
but this will pessimize. Ideally we should leverage the one problematic line:
p.2_6 = (int *) p_5;
which creates the pointer out of the integer, but it has already disappeared in
the very first RTL representation.