delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/03/02:15:41

From: cnc AT netcom DOT com (Christopher Christensen)
Date: Mon, 2 May 1994 22:39:00 PDT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: gcc bug report submitted to gnu.gcc.bug

I've submitted the following bug report to gnu.gcc.bug.  I thought it might
be of interest to the list so here it is.  This is almost certainly a bug
in gcc not go32.

I'm using DJGPP v 1.11.m5 (gcc 2.5.7) and I think I've run into a gcc bug.
I've tried to strip the source code down to the bare essentials needed to
recreate the bug:

file "bug.c"
-----------------------------------cut here----------------------------------
foo() { return 0; }

void fubar()
  {
  foo();
  asm(" " :: "a" (0)
      : "eax");
  }
-----------------------------------cut here----------------------------------

when I compile this with "gcc -c -O bug.c" I get the following error:

bug.c: In function `fubar':
bug.c:8: `asm' operand constraint incompatible with operand size

The error only appears when:
  * the '-O' compile option is used
  * the call to foo() immediately preceeds the asm statement
  * foo returns int or something other than void
  * the "a" operand constraint is used to load the EAX register
  * the EAX register is listed as a clobbered register

Here is the output from "gcc -v -c -O bug.c"
-----------------------------------cut here----------------------------------
Reading specs from c:/djgpp/lib/specs
gcc version 2.5.7
 c:/djgpp/bin/cpp.exe -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS -D__OPTIMIZE__ bug.c c:/tmp/cc006533
GNU CPP version 2.5.7 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 c:/djgpp/include
 /usr/local/include
 /usr/local/go32/include
 /usr/local/lib/gcc-lib/go32/2.5.7/include
 /usr/include
End of search list.
 c:/djgpp/bin/cc1.exe c:/tmp/cc006533 -fno-builtin -quiet -dumpbase bug.c -O -version -o c:/tmp/cca06533
GNU C version 2.5.7 (80386, BSD syntax) compiled by GNU C version 2.5.7.
bug.c: In function `fubar':
bug.c:8: `asm' operand constraint incompatible with operand size
-----------------------------------cut here----------------------------------


-- 
----------------------------------------------------------------------
:  Christopher  :  Huntington Beach California, USA                  :
:  Christensen  :  email:  cnc AT netcom DOT com                            :
----------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019