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: "pinskia at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2008 16:50:49 -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 #7 from pinskia at gmail dot com 2008-03-23 16:50 -------
Subject: Re: [4.3/4.4 Regression]: gcc-4.3 -O3/-ftree-vectorize regression:
incorrect code generation
This code violates c/c++ aliasing rules.
Sent from my iPhone
On Mar 23, 2008, at 6:33, "victork at gcc dot gnu dot org"
<gcc-bugzilla@gcc.gnu.org
> wrote:
>
>
> ------- Comment #6 from victork at gcc dot gnu dot org 2008-03-23
> 13:33 -------
> Here is AN even more reduced example which demonstrates the problem:
> int main()
> {
> char buf[256];
> char *dest;
> int i;
>
> dest = &buf[2];
> for (i = 0; i < 32; i++)
> {
> *(unsigned *)dest = 0;
> dest += 4;
> }
>
> return buf[2];
> }
>
> gcc -O3 t.c && ./a.out
> Segmentation fault
>
>
> The problem is that vectorizer is assuming that the access was
> aligned to the
> the size of the element before vectorization. A loop peeling only
> handles
> misalignment in multiples of element size.
> In this case, vectorizer could check the actual alignment in compile
> time and
> prevent vectorization. (Though the assignment of a constant still
> can be
> vectorized if value of constant is adjusted accordingly).
> In general case, when alignment of the non-vectorized access is
> unknown, a fix
> of this bug would require an addition of a run-time test.
>
>
> --
>
> victork at gcc dot gnu dot org changed:
>
> What |Removed |Added
> ---
> ---
> ----------------------------------------------------------------------
> AssignedTo|unassigned at gcc dot gnu |victork at gcc dot
> gnu dot
> |dot org |org
> Status|NEW |ASSIGNED
> Last reconfirmed|2008-03-21 17:47:58 |2008-03-23 13:33:08
> date| |
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35653
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35653