← Back to index
|
Original Bugzilla link
Bug 8581 – Internal error: backend/cod1.c 1677 on structs with bitfields (when compile with release or optimize parameter)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-08-24T02:50:00Z
Last change time
2013-11-21T02:57:12Z
Assigned to
nobody
Creator
kozzi11
Comments
Comment #0
by kozzi11 — 2012-08-24T02:50:55Z
Problematic code below: import std.bitmanip; struct Record { mixin(bitfields!( bool , "a" , 1, bool , "b" , 1, bool , "c" , 1, bool , "d", 1, bool , "e", 1, bool , "f" , 1, bool , "g" , 1, bool , "h" , 1 )); } enum RECORD_LENGTH = 16; enum EMPTY_RECORD_BITMASK = 0xff; void main(string[] args) { ubyte[] aw_buffer = cast(ubyte[])"Some data from file for e.g."; Record o_currentRecord; auto n_recordCount = aw_buffer.length / RECORD_LENGTH; auto p_records = cast(Record*)aw_buffer.ptr; foreach(n_index; 0 .. n_recordCount) { o_currentRecord = p_records[n_index]; bool isEmptyRecord = *(cast(ubyte * )(&(o_currentRecord.a))) == EMPTY_RECORD_BITMASK; if(isEmptyRecord) { // problematic place } else if (o_currentRecord.a == 0 && !o_currentRecord.b) { // problematic place } else if (o_currentRecord.a == 1 && o_currentRecord.d == 0) { // problematic place } else { } //BUT THIS WORKS // /* if(isEmptyRecord) { } */ //AND THIS WORKS TOO// /* if(any other condition expresion) { // problematic line } else if (o_currentRecord.a == 0 && !o_currentRecord.b) { } else if (o_currentRecord.a == 1 && o_currentRecord.d == 0) { } else { } */ } }
Comment #1
by kozzi11 — 2013-11-21T02:57:12Z
No problem anymore, wrong code with bad assumption.