This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/35653] [4.3/4.4 Regression]: gcc-4.3 -O3/-ftree-vectorize regression: incorrect code generation



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]