public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56392] New: Crash while filling an odd-pitch 16bpp image with auto-vectorization enabled on x86_64 Linux platform
@ 2013-02-19 11:45 s.jodogne at gmail dot com
  2013-02-19 11:52 ` [Bug c++/56392] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: s.jodogne at gmail dot com @ 2013-02-19 11:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56392

             Bug #: 56392
           Summary: Crash while filling an odd-pitch 16bpp image with
                    auto-vectorization enabled on x86_64 Linux platform
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: s.jodogne@gmail.com


Created attachment 29491
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29491
Source code to reproduce the problem

I have written a very simple code to fill a 32x32 16bpp image with a constant
value (1024). The pitch/stride of my image (i.e. the number of bytes between
two successive lines) is large enough to hold an entire line, but is purposely
set to an odd number. The code is attached to this report.

I am using Linux x86_64 with gcc 4.6.1 (Ubuntu 11.10). The code runs fine with
the -O0, -O1 and -O2 optimization levels. Valgrind does not report any access
violation. However, as soon as I switch to -O3 or use the -ftree-vectorize
option to enable auto-vectorization, the program crashes:

# g++ -g -O2 -ftree-vectorize ./test.cpp -Wall -pedantic && ./a.out
Segmentation fault

The crash does not happen when I switch to 32bit binaries with the -m32 gcc
flag. It does not occur either if I use an even pitch (e.g. pitch = width * 2 +
2). This is also a C++-related problem: the code does not crash when I use
malloc() instead of the new[] operator. The problem is also present in g++
4.4.6 and g++ 4.5.4.

As I understand, this is related to memory alignment due to the odd pitch, but
should not the code produced by gcc be protected against this?


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

end of thread, other threads:[~2013-02-19 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 11:45 [Bug c++/56392] New: Crash while filling an odd-pitch 16bpp image with auto-vectorization enabled on x86_64 Linux platform s.jodogne at gmail dot com
2013-02-19 11:52 ` [Bug c++/56392] " rguenth at gcc dot gnu.org
2013-02-19 11:57 ` s.jodogne at gmail dot com
2013-02-19 12:25 ` rguenth at gcc dot gnu.org
2013-02-19 15:26 ` org.gnu.gcc.bugtracker at sotecware dot net
2013-02-19 15:52 ` redi 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).