This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/85923] invalid code generation when incrementing pointer referenced by pointer
- 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: Mon, 28 May 2018 08:58:17 +0000
- Subject: [Bug c/85923] invalid code generation when incrementing pointer referenced by pointer
- Auto-submitted: auto-generated
- References: <bug-85923-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85923
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is because you are violating strict-aliasing rules by accessing *Ptr
both via char * and unsigned char * which are two different pointer types.
Declaring Ptr as [const] unsigned char * or compiling with -fno-strict-aliasing
fixes your code.