This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
- From: "frag_dz8 at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Mar 2004 18:59:00 -0000
- Subject: [Bug inline-asm/14451] New: [x86-SSE] Segmentation fault when writing memory using UNALIGNED instruction
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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