This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc 2.7-b19 on gnu-win32 b19 generating bad asm


Fergus Henderson writes:
>GNU C version 2.7-b19 on gnu-win32 version b19.1 (intel x86)
>generates bad assembler for the following program.  The program
>(cut down from C code automatically generated by the Mercury compiler)
>is not strictly conforming, but even so, the generated assembler
>is pretty nonsensical.  This worked fine in b18.
>
>To reproduce the problem, compile the following program with `gcc -O2 -S'.

<snip code that was wrapped somewhere, so I couldn't test...>
>
>The generated code for the `goto' above is the assembler statement
>
>	jmp *%ecx
>
>but this is the *only* occurrence of %ecx in the generated code.
>%ecx is never initialized, and the reference to `mercury__compare_3_3'
>somehow gets optimized away entirely.

Of course if it really did work with b18 then I will be completely wrong.
Also if gcc has been patched on cygwin32 I'll be wrong. But anyway...

Using -O2 to me is a lot risky since my docs say :

Users of gcc 2.7.0 thru 2.7.2 should note that there is a bug in -O2 on
these. Specifically, strength reduction doesn't work. A patch can be
had to fix this if you feel like recompiling gcc, otherwise make sure
that you always compile with -fno-strength-reduce.

Now strength-reduction does loop-strength reduction and elimination of
iteration variables... Possibly not what is happening in your case, but you
could try with the extra option and see. 

It's probably not the reason, but I couldn't test it because I couldn't
be bothered reformatting yur wrapped code...

Sam

---
testing? What's that? If it compiles, it is good, if it boots up it
is perfect. --Linus Torvalds


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]