[Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated"

2005-12-04 Thread jason dot mcmullan at gmail dot com
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



[Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"

2005-12-04 Thread jason dot mcmullan at gmail dot com


--- Comment #1 from jason dot mcmullan at gmail dot com  2005-12-04 22:32 
---
Created an attachment (id=10405)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10405&action=view)
Patch to fix the reported issue

This patch fixes the reported h8300-specific bug


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25255



[Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"

2005-12-04 Thread jason dot mcmullan at gmail dot com


--- Comment #2 from jason dot mcmullan at gmail dot com  2005-12-04 22:34 
---
I have attached a patch that fixes the bug by defining
'TARGET_ASM_UNALIGNED_??_OP' in gcc/config/h8300/h8300.c

I have confirmed through assembly dumps and object code dumps
that this patch works with GNU assembler version 2.16.1 for the h8300.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25255