This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/48052] loop not vectorized if index is "unsigned int"
- 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, 10 Mar 2011 09:46:21 +0000
- Subject: [Bug tree-optimization/48052] loop not vectorized if index is "unsigned int"
- Auto-submitted: auto-generated
- References: <bug-48052-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.03.10 09:46:16
CC| |spop at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-10 09:46:17 UTC ---
This is a known issue with POINTER_PLUS_EXPR semantics, how the C frontend
handles pointer-based array accesses and fold. And in the end SCEV analysis.
The issue is we end up with
*(c + (((long unsigned int)i) * 8))
with that 'long unsigned int' being sizetype. At the point of SCEV
analysis we do not factor in the fact that i does not wrap around and
that because of this the evolution is
{ c, +, 8 }
With signed integers we simply exploit undefined behavior.
So yes, it's a known problem (but I always fail to remember a testcase
where it matters ;)).
In the very end my plan was to fix this all with no-undefined-overflow
branch, but maybe Sebastian can think of a way to use number-of-iteration
analysis in SCEV? (Ugh, that's a chicken-and-egg problem, no?)