If a structure has a pointer to itself, and is packed, on the h8300
architecture, I get a compiler error of 'error: initializer for integer
value is too complicated'. This does not occur on the x86 architecture,
nor does it occur on un-packed structures.
Also, the compiler argument '-fpack-struct=1' will cause the same error
to arise on un-packed structures. Curiously, this does not occur with
any of '-fpack-struct=2', '-fpack-stuct=4', nor '-fpack-struct=8'
$ h8300-linux-hms-gcc -c testcase.c
testcase.c:18: error: initializer for integer value is too complicated
(Line 18 is the last line of the 'bad_example' initializer)
$ h8300-linux-hms-gcc -v
Using built-in specs.
Target: h8300-linux-hms
Configured with: ../configure --target=h8300-linux-hms --prefix=/opt/renesas :
(reconfigured) ../configure --target=h8300-linux-hms --prefix=/opt/renesas
--enable-language=c : (reconfigured) ../configure --target=h8300-linux-hms
--prefix=/opt/renesas --enable-languages=c
Thread model: single
gcc version 4.0.2
-- START EXAMPLE CODE testcase.c -
struct good {
struct good *self;
};
struct good good_example =
{
.self = &good_example
};
struct bad {
struct bad *self;
} __attribute__((packed));
struct bad bad_example =
{
.self = &bad_example
};
-- END EXAMPLE CODE testcase.c -
--
Summary: packed structure: pointers to self result in "error:
initializer for integer value is too complicated"
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jason dot mcmullan at gmail dot com
GCC build triplet: i586-mandriva-linux-gnu
GCC host triplet: i586-mandriva-linux-gnu
GCC target triplet: h8300-linux-hms
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25255