Mail Archives: djgpp/2000/04/12/17:25:22
Hi Hans-Bernhard!
> > 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:
Better try it under 2.95.2. You'll encounter the same thingy.
AND THE CODE IS DEFINETELY NOT BUGGY!!! the program compiles and works as it
should. Don't you think if program works normally, source is okay too? Or you
think EXE is no made out of the source at all???
> 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.
"(address)" means reference to RAM in AT&T syntax, so I always keep these
parentheses. IMO GCC doesn't convert inline ASM to the ASM recognized by AS.
Btw, the following program compiles both with -O2 and w/o -O at all:
----------8<----------
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main() {
int a=1, b=2, c=3, d;
clrscr();
__asm__ __volatile__ ("
fstcw (%3)
movl (%0), %%eax
addl (%1), %%eax
addl (%2), %%eax
movl %%eax, (%3)"
:
: "g" (&a), "g" (&b), "g" (&c), "g" (&d)
: "eax"
);
printf ("%d\n", d);
return 0;
}
----------8<----------
I simply load the above program to RHIDE instead of the previous one (which I
posted to NG recently) and it compiles while the previos not. What do you think
of it, huh?
bye.
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror: http://members.xoom.com/alexfru
- Raw text -