Ticket #396 (Fixed)Tue Sep 16 09:37:13 UTC 2014
Named aggregate initialisers on unions don't always work
Reported by: | Rik Griffin (98) | Severity: | Major |
Part: | RISC OS: C/C++ toolchain | Release: | |
Milestone: | Status | Fixed |
Details by Rik Griffin (98):
The following code causes the C compiler (5.69) to throw an internal error:
typedef union {
struct {
unsigned int a : 1;
unsigned int b : 1;
} bits;
} OTP_FeatureBits_t;
static OTP_FeatureBits_t FeatureBits = {
.bits.a = 1,
.bits.b = 1
};
int main(void) {
return 0;
}
The output of cc is:
Norcroft RISC OS ARM C vsn 5.69 [27 Mar 2011]
“RAM::RamDisc0.$.c.main”, line 14: Fatal internal error: readbackdcI
Internal inconsistency: either resource shortage or compiler fault. If you
cannot alter your program to avoid this failure, please contact your supplier
Moving the ‘unsigned int word;’ to the start of the union definition avoids the error.
Changelog:
Modified by Jeffrey Lee (213) Sun, November 02 2014 - 14:28:52 GMT
- Status changed from Open to Fixed
Appears to be fixed with CC 5.71 (DDE 25) – no error is produced, and there are a few struct/union related fixes mentioned in the changelog.