Search

Compiler Bug when generating data. by Tom van Dijck

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 582063
Opened: 7/31/2010 3:00:56 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
It appears that if I define static data that maps onto a 'struct' I can get errors in the generated output... But only, if I do so in a dll, and in release mode.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

 

Steps to reproduce

Included is a Visual Studio 2008 Project, which reproduces the error in both Visual Studio 2008 and 2010. Just build and run in debug, print the output... then build and run in release, print the output, and note the difference, where it would be expected that both release and debug output the exact same.

So far I've really only been able to repro it with this specific struct definition and only in a dll and only in release builds.. adding #pragma optimize(off) doesn't help.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

MinSlot: 0
MaxSlot: 1
DataSize: 16
Alignment: 16
StringTableOffset: 160
StringTableLength: 32
Reordered: 0
Native: 1
Hash: 0x00000001
- LayoutHash: 0xf10a1000
- ElementSize: 4
- Offset: 0
- Name: 0
- Count: 9
- Flags: 0
- ElementAlign: 4
- RLE: 0
- LayoutHash: 0xf10a1000
- ElementSize: 4
- Offset: 0
- Name: 4
- Count: 11
- Flags: 0
- ElementAlign: 4
- RLE: 0

Expected results

MinSlot: 0
MaxSlot: 1
DataSize: 16
Alignment: 16
StringTableOffset: 160
StringTableLength: 32
Reordered: 0
Native: 1
Hash: 0x00000001
- LayoutHash: 0xf10a1000
- ElementSize: 4
- Offset: 0
- Name: 9
- Count: 1
- Flags: 0
- ElementAlign: 4
- RLE: 2
- LayoutHash: 0xf10a1000
- ElementSize: 4
- Offset: 4
- Name: 11
- Count: 1
- Flags: 0
- ElementAlign: 4
- RLE: 1
File Attachments
File Name Submitted By Submitted On File Size  
datacompilebug.zip 7/31/2010 32 KB
datacompilebug.zip 7/31/2010 32 KB
Sign in to post a comment.
Posted by Microsoft on 8/16/2010 at 5:51 PM
Hi. Thanks for reporting this bug!

We can reproduce the issue and are working on a fix.

Meanwhile, you can workaround this issue by using pragma optimize directive to selectively disable the optimizer.

MSDN documentation is here http://msdn.microsoft.com/en-us/library/chh3fb0k.aspx

and you will add pragma around the definition of your struct like this:

#pragma optimize("",off)

static NativeVectorLayout gLayoutVector2 = { ... };

#pragma optimize("",on)


Thanks again for your report
Seunghun Thomas Lee
Posted by Microsoft on 8/2/2010 at 1:01 AM
Thanks for your feedback. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/31/2010 at 5:09 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.