Mail Archives: djgpp/2000/04/10/17:29:16

Sender: root AT delorie DOT com
Message-ID: <>
Date: Mon, 10 Apr 2000 17:31:29 -0300
From: salvador <salvador AT inti DOT gov DOT ar>
Organization: INTI
X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.38 i686)
X-Accept-Language: es-AR, en, es
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: inefficiency of GCC output code & -O problem
References: <38F20E7A DOT 3330E9A4 AT mtu-net DOT ru>
Reply-To: djgpp AT delorie DOT com

"Alexei A. Frounze" wrote:

> Hi!
> 1st question...
> Why GCC output too much redundant code?
> I mean, it always put values to the CPU registers, although it's possible to
> make the same operation w/o taking registers?

Are you using -O? Are these variables global?

> Also why GCC does type cast of byte/word <-> dword values so awful? It allocates
> some extra bytes on the stack, put values there and get them back...

You are not optimizing, that's why.

> Is it a normal thing, if one instruction that adds something to ESP(or EBP) is
> followed by sutracting instruction that works with the same register?


> ... I'll find some extra info later ...
> 2nd question...
> Why the "-O2" switch works normally for pure C source code and makes compiler
> failing on the source with inline assembly (in the .S file made out of such .C
> an error encounters:
> "Error: Error: Missing ')' assumed"
> "Error: Error: Ignoring junk `(%ebp))' after expression")?
> W/o the -O2 switch it's compiled fine. Isn't it a little bit strange?

Can you show a small example? I guess that's an error in your inline assembler
code, but I can't know without the actual code.


Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: or
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
                    set AT ieee DOT org set-soft AT bigfoot DOT com
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013

- Raw text -

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