public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code
@ 2004-10-11 16:11 terpstra at ito dot tu-darmstadt dot de
  2004-10-11 16:13 ` [Bug c/17934] " terpstra at ito dot tu-darmstadt dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: terpstra at ito dot tu-darmstadt dot de @ 2004-10-11 16:11 UTC (permalink / raw)
  To: gcc-bugs

For whatever reason, the attached program, when compiled with the options
gcc-3.4 -msse2 -O0 test.c -o test
will crash. This is not the case if -O2 is specified or -march=i686.

However, I have a larger testcase (the program this came from) which will fail
regardless of optimization flags or -march. It seems that this problem only
happens when gcc is given complicated enough code.

A quick look at it with gdb shows:
Program received signal SIGSEGV, Segmentation fault.
0x080483b0 in _mm_srli_epi32 (__A={51539607552, 51539607564}, __B=31)
    at emmintrin.h:1261
1261    {
(gdb) up
#1  0x080483e3 in bar (x={4294967297, 4294967297}, y={4294967297, 4294967297})
    at test.c:8
8               return _mm_sub_epi32(x, _mm_srli_epi32(y, 31));
(gdb) print &x
$1 = (__v2di *) 0xbffffa00
(gdb) down
#0  0x080483b0 in _mm_srli_epi32 (__A={51539607552, 51539607564}, __B=31)
    at emmintrin.h:1261
1261    {
(gdb) print &__A
$2 = (__v2di *) 0xbffff9cc

This looks to me like the alignment has somehow gotten messed up.

-- 
           Summary: gcc produces bad (misaligned?) sse2 code
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terpstra at ito dot tu-darmstadt dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-linux-gnu
  GCC host triplet: i386-linux-gnu
GCC target triplet: i386-linux-gnu


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


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

* [Bug c/17934] gcc produces bad (misaligned?) sse2 code
  2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
@ 2004-10-11 16:13 ` terpstra at ito dot tu-darmstadt dot de
  2004-10-11 16:17 ` terpstra at ito dot tu-darmstadt dot de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: terpstra at ito dot tu-darmstadt dot de @ 2004-10-11 16:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From terpstra at ito dot tu-darmstadt dot de  2004-10-11 16:13 -------
Created an attachment (id=7326)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7326&action=view)
The program which demonstrates the problem

Here's what I narrowed it down to.
Compile with: gcc-3.4 -msse2 -O0 test.c -o test
./test
Segfault!


-- 


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


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

* [Bug c/17934] gcc produces bad (misaligned?) sse2 code
  2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
  2004-10-11 16:13 ` [Bug c/17934] " terpstra at ito dot tu-darmstadt dot de
@ 2004-10-11 16:17 ` terpstra at ito dot tu-darmstadt dot de
  2004-10-11 17:09 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: terpstra at ito dot tu-darmstadt dot de @ 2004-10-11 16:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From terpstra at ito dot tu-darmstadt dot de  2004-10-11 16:17 -------
Oh, and this problem doesn't occure in gcc 3.3.
However, gcc-3.3 ICEs on the larger program.
Since it at least compiles on gcc-3.4, I assume that is a different bug which
got fixed.

-- 


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


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

* [Bug c/17934] gcc produces bad (misaligned?) sse2 code
  2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
  2004-10-11 16:13 ` [Bug c/17934] " terpstra at ito dot tu-darmstadt dot de
  2004-10-11 16:17 ` terpstra at ito dot tu-darmstadt dot de
@ 2004-10-11 17:09 ` pinskia at gcc dot gnu dot org
  2004-10-11 17:22 ` terpstra at ito dot tu-darmstadt dot de
  2004-10-11 17:26 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-11 17:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-11 17:09 -------


*** This bug has been marked as a duplicate of 10395 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c/17934] gcc produces bad (misaligned?) sse2 code
  2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
                   ` (2 preceding siblings ...)
  2004-10-11 17:09 ` pinskia at gcc dot gnu dot org
@ 2004-10-11 17:22 ` terpstra at ito dot tu-darmstadt dot de
  2004-10-11 17:26 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: terpstra at ito dot tu-darmstadt dot de @ 2004-10-11 17:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From terpstra at ito dot tu-darmstadt dot de  2004-10-11 17:22 -------
This bug does not in any way involve multiple threads.
In my attached test case, gcc starts with an aligned stack and screws up the
alignment by itself.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


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


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

* [Bug c/17934] gcc produces bad (misaligned?) sse2 code
  2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
                   ` (3 preceding siblings ...)
  2004-10-11 17:22 ` terpstra at ito dot tu-darmstadt dot de
@ 2004-10-11 17:26 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-11 17:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-11 17:26 -------
No, the problem is that main is not aligned see that bug again.

*** This bug has been marked as a duplicate of 10395 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-10-11 17:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 16:11 [Bug c/17934] New: gcc produces bad (misaligned?) sse2 code terpstra at ito dot tu-darmstadt dot de
2004-10-11 16:13 ` [Bug c/17934] " terpstra at ito dot tu-darmstadt dot de
2004-10-11 16:17 ` terpstra at ito dot tu-darmstadt dot de
2004-10-11 17:09 ` pinskia at gcc dot gnu dot org
2004-10-11 17:22 ` terpstra at ito dot tu-darmstadt dot de
2004-10-11 17:26 ` pinskia at gcc dot gnu dot 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).