This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/35653] [4.3/4.4 Regression]: gcc-4.3 -O3/-ftree-vectorize regression: incorrect code generation
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Mar 2008 12:28:25 -0000
- Subject: [Bug tree-optimization/35653] [4.3/4.4 Regression]: gcc-4.3 -O3/-ftree-vectorize regression: incorrect code generation
- References: <bug-35653-15165@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from rguenth at gcc dot gnu dot org 2008-03-25 12:28 -------
The C/C++ standards say that if you access memory through int, the data has
to be aligned suitably according to what the ABI specifies for alignment of
int.
If you mis-align the access on purpose you have to tell the compiler, one
means of doing so is by using the aligned attribute or by using a packed
structure. The vectorizer will then see the misalignment if it (hopefully)
uses get_pointer_alignment (or TYPE_ALIGN or whatever is suitable).
It is not expected that the vectorizer can deal with the situation in the
original report.
For this reason I think this bugreport is invalid.
char c[4];
*(int *)&c[0]
the access invokes undefined behavior at runtime if you do not make sure
c is properly aligned. On strict alignment targets this will fault
regardless of vectorization or not.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35653