public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/5115: Inline asm generates incorrect assembler code
@ 2001-12-14  6:06 aliberi
  0 siblings, 0 replies; 3+ messages in thread
From: aliberi @ 2001-12-14  6:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5115
>Category:       other
>Synopsis:       Inline asm generates incorrect assembler code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 14 06:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Armand Liberi
>Release:        2.9-gnupro-98r2
>Organization:
>Environment:
rde3# gcc -v -save-temps -o fpsave fpsave.c
Reading specs from /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/specs
gcc version 2.9-gnupro-98r2
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/cpp -lang-c -v -iprefix /bin/
../lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/ -undef -D__GNUC__=2 -D__GNUC_MI
NOR__=9 -D__Lynx__ -D__x86__ -D__LITTLE_ENDIAN__ -D__Lynx__ -D__x86__ -D__LITTLE
_ENDIAN__ -Asystem(lynx) -Acpu_arch(x86) -Acpu(i386) -D__i386__ fpsave.c fpsave.
i
GNU CPP version 2.9-gnupro-98r2 (x86, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/../../../../include
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/../../../../i386-coff-lynxos/
include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/cc1 fpsave.i -quiet -dumpbase
 fpsave.c -version -o fpsave.s
GNU C version 2.9-gnupro-98r2 (i386-coff-lynxos) compiled by GNU C version 2.9-g
nupro-98r2.
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/../../../../i386-coff-lynxos/
bin/as -o fpsave.o fpsave.s
 /usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2/collect2 -o fpsave /lib/init1
.o -L/usr/lib/gcc-lib/i386-coff-lynxos/2.9-gnupro-98r2 -L/usr/lib/gcc-lib/i386-c
off-lynxos/2.9-gnupro-98r2/../../../../i386-coff-lynxos/lib -L/usr/local/lib fps
ave.o -lgcc -lm -lc -lgcc /lib/initn.o
>Description:
Hello,

With the variable declarations:

unsigned int singleInt;
unsigned int lotsOfInts[100]={0};

	asm ("FSTPL %0":"=m" (singleInt));

generates "FSTPL singleInt" as expected, and

	asm ("FSTPL %0":"=m" (lotsOfInts));

generates "FSTPL lotsOfInts" as expected, and

	asm ("FLDL %0"::"m" (singleInt));

generates "FLDL singleInt" as expected, BUT

	asm ("FLDL %0"::"m" (lotsOfInts));

generates "FLDL .LC0" which is NOT expected.

This actually happened using an FSAVE/FRSTOR sequence in a SIGFPE signal handler.  As th eabove illustrates, it was not the instruction but that caused the problem - just that an array address is involved rather than a single variable.  We pay for support from LynuxWorks and they gave me two fixes shown below.  Those also appear to be bugs to me but, like so many other people, I'm a little confused about the constraint rules, etc., and cannot find any clear statement of those rules.  But, I guess that's another problem.

Regards,
Armand

He who asks is a fool for five minutes, but he who does not ask remains a fool forever. - Chinese proverb
Life is just one five minute period after another. - Armand Liberi
>How-To-Repeat:
'gcc -save-temps' the attached file using any version of GCC, I think (I have tried the one described above, the one with RedHat Linux 7.2, and the latest and greatest from CygWin.
>Fix:
Two have been suggested to me by LynuxWorks support:

1.  Change 'asm ("FLDL %0"::"m" (lotsOfInts));'
    to 'asm ("FLDL %0":"=m" (lotsOfInts));'.  I.E., use an output constraint to describe an input (???)

2.  Use 'asm ("FLDL lotsOfInts);'.  I.E., don't use constraints.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: other/5115: Inline asm generates incorrect assembler code
@ 2001-12-14  9:16 cgf
  0 siblings, 0 replies; 3+ messages in thread
From: cgf @ 2001-12-14  9:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5115; it has been noted by GNATS.

From: cgf@gcc.gnu.org
To: aliberi@acutronic.com, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: other/5115: Inline asm generates incorrect assembler code
Date: 14 Dec 2001 17:08:00 -0000

 Synopsis: Inline asm generates incorrect assembler code
 
 State-Changed-From-To: open->closed
 State-Changed-By: cgf
 State-Changed-When: Fri Dec 14 09:07:59 2001
 State-Changed-Why:
     This is a special release of the compiler, released three years ago by Cygnus Solutions (now Red Hat).  Please contact Red Hat for support.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5115&database=gcc


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

* Re: other/5115: Inline asm generates incorrect assembler code
@ 2001-12-14  9:08 cgf
  0 siblings, 0 replies; 3+ messages in thread
From: cgf @ 2001-12-14  9:08 UTC (permalink / raw)
  To: aliberi, gcc-bugs, gcc-gnats, gcc-prs, nobody

Synopsis: Inline asm generates incorrect assembler code

State-Changed-From-To: open->closed
State-Changed-By: cgf
State-Changed-When: Fri Dec 14 09:07:59 2001
State-Changed-Why:
    This is a special release of the compiler, released three years ago by Cygnus Solutions (now Red Hat).  Please contact Red Hat for support.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5115&database=gcc


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

end of thread, other threads:[~2001-12-14 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-14  6:06 other/5115: Inline asm generates incorrect assembler code aliberi
2001-12-14  9:08 cgf
2001-12-14  9:16 cgf

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