Bug 7926 - i486 instructions in header files make c++ programs crash on i386
Summary: i486 instructions in header files make c++ programs crash on i386
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Benjamin Kosnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-16 00:26 UTC by mschill4
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mschill4 2002-09-16 00:26:00 UTC
When configuring and building gcc 3.2 on a i386-linux machine
c++ programs fail because you use 486 code in inline assembler
statements in your atomicity headers (xadd, cmpxchg and others)
libjava has the same problems. It would be nice if you could
rework the header files to use non-atomic i386 instructions
if such behaviour is required. A special configure option
would do, too. If you need help how the appropriate headers
for i386 might look like, mail me, but I haven't got the
files around here at the university, so it might take some
time to send them in...

Release:
gcc-3.2

Environment:
i388 running Linux 2.2.21 and glibc 2.2.5

How-To-Repeat:
You can't repeat it unless you still have an old i386 around...
Comment 1 mschill4 2002-09-16 00:26:00 UTC
Fix:
rework i386 atomicity header files to make a distinction
between i386 and i486 and newer...
Comment 2 Phil Edwards 2002-09-16 09:53:09 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Thank you for your bug report.
    
    We already make a distinction between i386 and higher.
    If we compare those two files:
    
       % cd libstdc++-v3/config/cpu
       % diff i386/atomicity.h i486/atomicity.h
       1c1
       < // Low-level functions for atomic operations: x86, x < 4 version  -*- C++ -*-
       ---
       > // Low-level functions for atomic operations: x86, x >= 4 version  -*- C++ -*-
       58,59d57
       <
       <
       %
    
    Well, crumbs.  That's embarassing.
    
    I have not done any CVS archaeology to find out when
    this happened, but I'm sure it was a long time ago.
    (Those files are rarely changed.)  And it's gone undetected
    this long because there are only five i386 machines still
    in use, and you have one of them.  :-)
    
    Somebody more familiar with i386 will have to rewrite
    those instructions.  And remove those two useless blank
    lines.  :-)
Comment 3 Benjamin Kosnik 2002-11-01 17:45:53 UTC
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-Why: Mine.
Comment 4 Benjamin Kosnik 2002-11-01 17:45:53 UTC
State-Changed-From-To: analyzed->feedback
State-Changed-Why: This target, i386, should have been using the generic configuration, not the i486 files. I switched it. 
    
    -benjamin
Comment 5 Benjamin Kosnik 2002-11-02 01:42:23 UTC
From: bkoz@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libstdc++/7926
Date: 2 Nov 2002 01:42:23 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	bkoz@gcc.gnu.org	2002-11-01 17:42:22
 
 Modified files:
 	libstdc++-v3   : ChangeLog configure.target 
 Removed files:
 	libstdc++-v3/config/cpu/arm: atomicity.h 
 	libstdc++-v3/config/cpu/i386: atomicity.h 
 	libstdc++-v3/config/cpu/x86-64: atomicity.h 
 
 Log message:
 	2002-11-01  Benjamin Kosnik  <bkoz@redhat.com>
 	
 	PR libstdc++/7926
 	* configure.target: Simplify.
 	* config/cpu/i386/atomicity.h: Remove.
 	* config/cpu/i386: Remove.
 	* config/cpu/arm/atomicity.h: Remove.
 	* config/cpu/arm: Remove.
 	* config/cpu/x86-64/atomicity.h: Remove.
 	* config/cpu/x86-64: Remove.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1410&r2=1.1411
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/configure.target.diff?cvsroot=gcc&r1=1.53&r2=1.54
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/cpu/arm/atomicity.h.diff?cvsroot=gcc&r1=1.4&r2=NONE
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/cpu/i386/atomicity.h.diff?cvsroot=gcc&r1=1.3&r2=NONE
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/cpu/x86-64/atomicity.h.diff?cvsroot=gcc&r1=1.1&r2=NONE
 
Comment 6 Benjamin Kosnik 2002-11-11 15:05:25 UTC
State-Changed-From-To: feedback->closed
State-Changed-Why: This is fixed on mainline.