Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2005

Tip: Looking for answers? Try searching our database.

Is this a VC7.1 optimizer bug?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James Edwards - 12 Sep 2005 05:49 GMT
I'm seeing a problem where with -O2 -Ob2 on, my compiled code loads the
floating point value 1.0f on top of the floating point register stack (ST0),
then calls some functions (which happens to call driver functions in the
kernel), then later when it needs to assign the constant 1.0f to a variable,
it tries to use the value stored in ST0.  The only problem is that the 1.0f
value is no longer there, the call into the kernel has set ST0 to float NaN!  
Is this a problem with the VC optimizer (incorrectly assuming calls won't
modify the FP stack) or with the kernel call that modifies the FP stack?
David Lowndes - 12 Sep 2005 07:33 GMT
>I'm seeing a problem where with -O2 -Ob2 on, my compiled code loads the
>floating point value 1.0f on top of the floating point register stack (ST0),
>then calls some functions (which happens to call driver functions in the
>kernel), then later when it needs to assign the constant 1.0f to a variable,
>it tries to use the value stored in ST0.  The only problem is that the 1.0f
>value is no longer there, the call into the kernel has set ST0 to float NaN!  

James,

Do you have a short example that anyone can use to reproduce the
problem?

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

James Edwards - 12 Sep 2005 08:24 GMT
> >I'm seeing a problem where with -O2 -Ob2 on, my compiled code loads the
> >floating point value 1.0f on top of the floating point register stack (ST0),
[quoted text clipped - 7 lines]
> Do you have a short example that anyone can use to reproduce the
> problem?

No, and it's unlikely I can make one since the kernel call in question is
NtGdiDrawPrimitives2, which calls into graphics driver code which of course
is video-card specific, and the problem only occurs with my rather large
dataset, although it is 100% reproducible.   I was just hoping some
assembly/windows kernel guru would know if I should be pointing the finger of
blame at the compiler or the kernel/driver.
David Lowndes - 12 Sep 2005 09:03 GMT
>> Do you have a short example that anyone can use to reproduce the
>> problem?
[quoted text clipped - 3 lines]
>is video-card specific, and the problem only occurs with my rather large
>dataset, although it is 100% reproducible.

A quick google on that kernel call you mention shows up nothing, so I
think the hard part is going to be finding someone who's familiar with
that. I don't know where to suggest you find such a person.

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.