Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Codewarrior Windows > CW 8 compiler b...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 231 of 318
Post > Topic >>

CW 8 compiler bug: [Was: Long long, optimization and weird debugger errors]

by luz_info@[EMAIL PROTECTED] (Lukas Zeller) Nov 17, 2004 at 11:18 AM

Hello,

the original post is nearly 2 years ago, but it seems that the problem
described then still exists at least up to CW Win 8.3:

When the Optimization Level is > 1, long longs are sometimes not
passed on the stack but in a register pair. In this case the value
passed is destroyed (32 bits of the 64 bit contain garbage). This is
really happening in the code, and is not a debugger inspection issue.
I verified this by compiling the entire project without touching a
single source line once for each optimizer level. At 0 and 1, it works
as ist should; at Levels 2-4, long longs get corrupted.

In addition, there seems to be a debugger bug that displays 64bit
values stored in a register pair with longwords swapped.
The debugger problem is a "oops"; I know that debugging optimized code
is not reliable (however sometimes inevitable like here, when trying
to track down why the optimized code behaves differently... The
compiler bug combined with the debugger bug caused this to be very
very time consuming, it cost me a full day :-(

The actual compiler bug however is catastrophic, especially because
there are apparently many cases of passing long longs where everything
works ok, and only under special circumstances it is not. Simply
moving a routine's implementation from one (large) source file to
another (smaller) one has made the difference in my case.

Reading trough the CW Win 9 release notes, I found:

* Fixed bug spilling long longs.  If only the upper half was spilled,
  only four bytes would be allocated (but addressed at an offset of
  4), leading to stack corruption.  (WB1-49664) (26 September 2003)

This sounds at least related, but does not exactly match what I see
happening.

As this potentially could have desastrous effects (but for mere luck
apparently did not in the past two years I was using CW 8), I am very
worried using the optimizer at all until I know what's really
happening, and if the WB1-49664 release note entry below means that it
is now fixed.

Thanks for any information about this in advance!

luz




 2 Posts in Topic:
CW 8 compiler bug: [Was: Long long, optimization and weird debug
luz_info@[EMAIL PROTECTED  2004-11-17 11:18:38 
Re: CW 8 compiler bug: [Was: Long long, optimization and weird d
MW Ron <mwron@[EMAIL P  2004-11-17 15:19:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 17:26:20 CDT 2008.