public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
@ 2004-03-05 18:59 frag_dz8 at libero dot it
  2004-03-05 21:03 ` [Bug inline-asm/14451] " wilson at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: frag_dz8 at libero dot it @ 2004-03-05 18:59 UTC (permalink / raw)
  To: gcc-bugs

To tell the truth, this should probably be posted also to libstdc++ or maybe c++.
I have not a minimal using intrinsics, so I'll post it here.

*** GCC version ***
3.2.2, comes from RH 9.0 out-of-the-box.

*** System type ***
CPU: Athlon XP 1800+ Palomino core 1553Mhz
RAM: 1x256 MB DDR333 CAS2
Main board: Soltek SL75DRV5
Running linux RH 9.0 out-of-the-box. I know very little about OSs in general,
even less for unixes.

*** Options given when GCC was configured/built ***
Unknown.


*** Complete command line that triggers the bug ***
Program is built using: "g++ -o bailOut.bin -msse bailOut_minimized.cpp"
Program is run using: "./bailOut.bin"


*** Compiler output ***
None. Compiler seems to work fine.


*** the preprocessed file (*.i*) ***
I'll send this to gcc-bugs@gcc.gnu.org after this bug will be submitted. Will
use "[x86-SSE] Segmentation fault when writing memory using UNALIGNED
instruction" as subject.
File will be attached.

*** Source files ***
Will also send this.
File will be attached but it's also pasted here.
<code>
///////////////////////////////////////////////////////////////////////////////
//
// Compiled with "$ g++ -o bailOut.bin -msse bailOut_minimized.cpp" produces
// following output: "Segmentation fault"
//
///////////////////////////////////////////////////////////////////////////////
using namespace std;
#include <iostream>

int main(){
    float *buffer = new float[4];
    if(!buffer) return -1;
    
    cout<<((((unsigned)buffer) % 16) ? "No" : "Yes"); // 1) Uncomment this or
(2) and bug will go away.
    

    // Register -> Memory
    __asm__("MOVUPS %%xmm0, (%%eax)\n" : 
    	    "=a" (buffer) : : "xmm0");

    // Memory -> Register. Won't crash.
    ///__asm__("MOVUPS (%%eax), %%xmm0\n" :
    ///	    "=a" (buffer) :);
    
    cout<<"\nI fear this is buggy"; // 2) Uncomment this or (1) and bug will go
away.
    

    // This could be uncommented, but segmentation fault still occurs.
    delete[] buffer;
    return 0;
}
</code>


*** Comments ***
I firstly looked at bug 10395. This is worse because it's present on UNALIGNED
memory writes. Will try to reproduce the bug using intrinsics, but this will
take a while since I'll be away from PC in the next few days.
My apologies for the lenghty test case, I tried to make it as small as possible,
I could strip away some NULL-tests after new[] allocation, or the delete[] call
since I tested it and they don't seem to cause the bug.
Maybe it could be useful to know that, while searching for this minimal case, I
stumbled on a strange fact: compiling the program with -Ox didn't show the bug.
For this minimal case, the bug is here for all optimization levels (tested with
no optimization, -O, -O1, -O2, -O3). That program has been run on another PC and
showed the same behaviour however, the minimal test I'm submitting was tested
only on my Athlon.
Not sure about bug severity since the case is rather odd, however, deciding this
is up to you.

-- 
           Summary: [x86-SSE] Segmentation fault when writing memory using
                    UNALIGNED instruction
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: frag_dz8 at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ?
  GCC host triplet: ?
GCC target triplet: ?


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


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

* [Bug inline-asm/14451] [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
  2004-03-05 18:59 [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction frag_dz8 at libero dot it
@ 2004-03-05 21:03 ` wilson at gcc dot gnu dot org
  2004-03-06  3:54 ` pinskia at gcc dot gnu dot org
  2004-03-08 18:17 ` frag_dz8 at libero dot it
  2 siblings, 0 replies; 4+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-03-05 21:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-03-05 21:03 -------
The testcase is in
    http://gcc.gnu.org/ml/gcc-bugs/2004-03/msg00738.html


-- 


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


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

* [Bug inline-asm/14451] [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
  2004-03-05 18:59 [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction frag_dz8 at libero dot it
  2004-03-05 21:03 ` [Bug inline-asm/14451] " wilson at gcc dot gnu dot org
@ 2004-03-06  3:54 ` pinskia at gcc dot gnu dot org
  2004-03-08 18:17 ` frag_dz8 at libero dot it
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-06  3:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-06 03:54 -------
"=a" (buffer) means that the buffer will be set and not you are doing to store into the memory.
after replace the inline-asm to:
    __asm__("MOVUPS %%xmm0, %0\n" :     
            "=m" (buffer) : : "xmm0");
Then I get a seg fault after the printing to "NO" so this is a dup of bug 10395

*** 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=14451


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

* [Bug inline-asm/14451] [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
  2004-03-05 18:59 [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction frag_dz8 at libero dot it
  2004-03-05 21:03 ` [Bug inline-asm/14451] " wilson at gcc dot gnu dot org
  2004-03-06  3:54 ` pinskia at gcc dot gnu dot org
@ 2004-03-08 18:17 ` frag_dz8 at libero dot it
  2 siblings, 0 replies; 4+ messages in thread
From: frag_dz8 at libero dot it @ 2004-03-08 18:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From frag_dz8 at libero dot it  2004-03-08 18:17 -------
Subject: Re:  [x86-SSE] Segmentation fault when
	writing memory using UNALIGNED instruction

All right, I figure I should have never looked at ASM in the first
place. The intrinsic-based thing however crashes. Does it have to be
posted to this target?

Il sab, 2004-03-06 alle 04:54, pinskia at gcc dot gnu dot org ha
scritto: 
> -- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-06 03:54 --
> "=a" (buffer) means that the buffer will be set and not you are doing to store into the memory.
> after replace the inline-asm to:
>     __asm__("MOVUPS %%xmm0, %0\n" :     
>             "=m" (buffer) : : "xmm0");
> Then I get a seg fault after the printing to "NO" so this is a dup of bug 10395
> 
> *** This bug has been marked as a duplicate of 10395 ***



-- 


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


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

end of thread, other threads:[~2004-03-08 18:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-05 18:59 [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction frag_dz8 at libero dot it
2004-03-05 21:03 ` [Bug inline-asm/14451] " wilson at gcc dot gnu dot org
2004-03-06  3:54 ` pinskia at gcc dot gnu dot org
2004-03-08 18:17 ` frag_dz8 at libero dot it

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).