[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #6 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
See discussion in PR65709 for a similar issue.


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #5 from Richard Biener rguenth at gcc dot gnu.org ---
(In reply to Fei Yang from comment #4)
 (In reply to Markus Trippelsdorf from comment #2)
  You're invoking undefined behavior:
 
 test.c:34:12: runtime error: store to
  misaligned address 0x00401c8c for type 'unsigned char *', which requires
  8 byte alignment
 0x00401c8c: note: pointer points here
   00 00 00 00 00
  00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
  00 00 00
   ^ 
 
 So your testcase is invalid.
 
 Any reference? The testcase works fine without vectorization. thanks

It works fine without vectorization because on x86 unaligned non-vector
accesses do not trap.

Still the C standard says that pointers have to be suitably aligned.


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread felix.yang at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #4 from Fei Yang felix.yang at huawei dot com ---
(In reply to Markus Trippelsdorf from comment #2)
 You're invoking undefined behavior:

test.c:34:12: runtime error: store to
 misaligned address 0x00401c8c for type 'unsigned char *', which requires
 8 byte alignment
0x00401c8c: note: pointer points here
  00 00 00 00 00
 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
 00 00 00
  ^ 

So your testcase is invalid.

Any reference? The testcase works fine without vectorization. thanks


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #2 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
You're invoking undefined behavior:

test.c:34:12: runtime error: store to misaligned address 0x00401c8c for
type 'unsigned char *', which requires 8 byte alignment
0x00401c8c: note: pointer points here
  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
  ^ 

So your testcase is invalid.


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #7 from Richard Biener rguenth at gcc dot gnu.org ---
CCP computes this precisely:

Visiting PHI node: # PT = { D.1842 } (nonlocal, escaped)
p_3 = PHI MEM[(void *)xxx + 2444B](2), p_4(3)

Argument #0 (2 - 4 executable)
MEM[(void *)xxx + 2444B]  Value: CONSTANT MEM[(void *)xxx +
2444B]

Argument #1 (3 - 4 executable)
p_4 Value: CONSTANT 0x0 (0x0)

PHI node value: CONSTANT 0x0 (0x0)

but we don't record the alignment (because it looks useless to know - it's
byte alignment).  So the alignment on the access (invalid due to your use
of a bogus aligned type) prevails.


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread felix.yang at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

--- Comment #1 from Fei Yang felix.yang at huawei dot com ---
Also reproducible with GCC-5 and GCC-6.


[Bug tree-optimization/66804] Alignment issue caused by auto vectorization

2015-07-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66804

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
closing