Closed
Bug 568393
Opened 14 years ago
Closed 14 years ago
msvc 2008 compiler generates bad code for CallInfo static initializer
Categories
(Tamarin Graveyard :: Baseline JIT (CodegenLIR), defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: rreitmai, Unassigned)
References
Details
(Whiteboard: fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey)
Attachments
(1 file)
679 bytes,
patch
|
Details | Diff | Splinter Review |
CallInfo contains a mix of uint32_t and uint8_t bitfields that appears to confuses MSVC (see below). Changing the fields to uniformly use uin32_t fixes the issue: struct CallInfo { uintptr_t _address; uint32_t _typesig:27; // 9 3-bit fields indicating arg type, by ARGTYPE above (including ret type): a1 a2 a3 a4\ a5 ret AbiKind _abi:3; uint8_t _isPure:1; // _isPure=1 means no side-effects, result only depends on args AccSet _storeAccSet; // access regions stored by the function verbose_only ( const char* _name; ) The following program produces an incorrect result when using msvc 2008: // cl /Fa bug.cpp // // Look at assembly output and observe that the lower word of // S.a is being shoved into S.c : // // ... // and eax, 0x7ffffff // mov 0(_temp), eax // mov 0(s), eax // mov cl, 0(_temp) <= baaaad // mov 4(s), cl // #include "stdio.h" // notice last field of structure below is a unsigned char typedef struct _S { unsigned a:27; unsigned b:3; unsigned char c:1; // @FIX: change 'unsigned char' to 'unsigned' } S; // this function exists only to force 's' to be a dynamic initializer int rubish(int a) { return 1; } S s = { rubish(0),0,0 }; void main(char* argv, int argc) { printf("s.c is %d - should be 0\n", s.c); }
Reporter | ||
Comment 1•14 years ago
|
||
previously review by wmaddox - pushed http://hg.mozilla.org/projects/nanojit-central/rev/f7c07b8ca96f
Reporter | ||
Comment 2•14 years ago
|
||
TR - http://hg.mozilla.org/tamarin-redux/rev/e3cf485a27fa
Whiteboard: fixed-in-nanojit, fixed-in-tamarin
Comment 3•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/f0d5f28aa61e
Whiteboard: fixed-in-nanojit, fixed-in-tamarin → fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey
Comment 4•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/3b300e72d88b
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•