public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67601] New: Vectorization of loop causes aligned access to possibly unaligned address
@ 2015-09-16 11:35 drohr at jwdt dot org
  2015-09-16 11:41 ` [Bug tree-optimization/67601] " trippels at gcc dot gnu.org
  2015-09-16 11:43 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: drohr at jwdt dot org @ 2015-09-16 11:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67601

            Bug ID: 67601
           Summary: Vectorization of loop causes aligned access to
                    possibly unaligned address
           Product: gcc
           Version: 4.8.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drohr at jwdt dot org
  Target Milestone: ---

Created attachment 36342
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36342&action=edit
Source code file to reproduce issue

The attached source crashes if compiled with
gcc-4.8.5 -march=native -O2 -ftree-vectorize -o test test.cpp
and it works with
gcc-4.8.5 -march=native -O0 -o test test.cpp

The problem appears with all gcc 4.8.x versions and on all systems I have
tested.
(Gentoo Linux and several RedHat versions, AMD MagnyCours CPU and Intel
Sandy-Bridge CPUs).

When the loop in the SetTracksEnd function is vectorized, the generated code
does not check whether the address is aligned, but it uses movdqa instruction
to load the data.

The problem does not appear in gcc 4.9 and newer, but new versions generate
completely different code, so I am not sure whether this issue has been fixed,
or whether it does no longer pop up by chance.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/67601] Vectorization of loop causes aligned access to possibly unaligned address
  2015-09-16 11:35 [Bug tree-optimization/67601] New: Vectorization of loop causes aligned access to possibly unaligned address drohr at jwdt dot org
@ 2015-09-16 11:41 ` trippels at gcc dot gnu.org
  2015-09-16 11:43 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-16 11:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67601

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 #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
gcc-4.8 isn't maintained anymore. Moreover your testcase is invalid, 
because it invokes undefined behavior:

test.cpp:18:33: runtime error: load of misaligned address 0x0000004014e3 for
type 'Long64_t', which requires 8 byte alignment
0x0000004014e3: note: pointer points here


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/67601] Vectorization of loop causes aligned access to possibly unaligned address
  2015-09-16 11:35 [Bug tree-optimization/67601] New: Vectorization of loop causes aligned access to possibly unaligned address drohr at jwdt dot org
  2015-09-16 11:41 ` [Bug tree-optimization/67601] " trippels at gcc dot gnu.org
@ 2015-09-16 11:43 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-16 11:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67601

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
You are invoking undefined behavior because you are dereferencing table in

        table[i]+=fTracksPointer;

and table is not aligned according to its type (Long64_t).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-16 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16 11:35 [Bug tree-optimization/67601] New: Vectorization of loop causes aligned access to possibly unaligned address drohr at jwdt dot org
2015-09-16 11:41 ` [Bug tree-optimization/67601] " trippels at gcc dot gnu.org
2015-09-16 11:43 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).