delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/12/14:56:05

Date: Wed, 12 Apr 2000 18:49:55 +0200
Message-Id: <200004121649.SAA12655@acp3bf.physik.rwth-aachen.de>
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
To: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
Cc: djgpp AT delorie DOT com
Subject: Re: inefficiency of GCC output code & -O problem
X-Newsgroups: comp.os.msdos.djgpp
In-Reply-To: <38F49A45.13F0AB1@mtu-net.ru>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

In article <38F49A45 DOT 13F0AB1 AT mtu-net DOT ru> you wrote:

> Here goes a part of my project. I simply removed as much code as
> needed to leave it along.

> Well, it still isn't compiled with the -O2 switch, although it's okay w/o it.

I somewhat doubt that. This code compiles with no -O switch I've
tried, on gcc-2.7.2. The error messages are always the same,
regardless what optimization level I use, including no optimization at
all (-O0). AFAICS, your code is plainly buggy. Here's the first
offending fragment of source code:

[...]
>   __asm__ __volatile__ ("
>     fstcw   (%0)
>     fldcw   (%1)
>     fldl    (%2)
>   "
>   :
>   : "g" (&SW), "g" (&LW), "g" (&X)
>   );

And this is the assembly this converts into (fstcw is line 478 of
Tmapping.s), after treatment by gcc-2.7.2:
        
    fstcw   (-192(%ebp))
    fldcw   (%edx)
    fldl    (%ecx)

And the error messages from the assembler about it are:
  
Tmapping.s:478: Error: Missing ')' assumed
Tmapping.s:478: Error: Ignoring junk '(%ebp))' after expression

Obviously, the assembler doesn't consider (-192(%ebp)) to be a correct
address operand for fstcw. Changing the code to
	
	fstcw %0

helps, but may not be the correct fix. The real assembly experts in the
will have to answer that.


-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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