This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49873] Optimizer regression
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Jul 2011 09:56:14 +0000
- Subject: [Bug tree-optimization/49873] Optimizer regression
- Auto-submitted: auto-generated
- References: <bug-49873-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49873
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-28 09:55:58 UTC ---
char *same_data = s.ptr + (data - s.ptr);
same_data[0] = 1;
same_data now points to s.ptr plus some offset that isn't computed in any
standard compliant way. As s.ptr is NULL the store is dead.
With
char *same_data = (char *)((uintptr_t) s.ptr + (uintptr_t) data - (uintptr_t)
s.ptr));
you would get the correct answer, avoiding all the undefinedness in your code.