public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25255]  New: packed structure: pointers to self result in "error: initializer for integer value is too complicated"
@ 2005-12-04 20:26 jason dot mcmullan at gmail dot com
  2005-12-04 22:32 ` [Bug target/25255] " jason dot mcmullan at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jason dot mcmullan at gmail dot com @ 2005-12-04 20:26 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"
  2005-12-04 20:26 [Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated" jason dot mcmullan at gmail dot com
@ 2005-12-04 22:32 ` jason dot mcmullan at gmail dot com
  2005-12-04 22:34 ` jason dot mcmullan at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jason dot mcmullan at gmail dot com @ 2005-12-04 22:32 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"
  2005-12-04 20:26 [Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated" jason dot mcmullan at gmail dot com
  2005-12-04 22:32 ` [Bug target/25255] " jason dot mcmullan at gmail dot com
@ 2005-12-04 22:34 ` jason dot mcmullan at gmail dot com
  2005-12-06 23:55 ` pinskia at gcc dot gnu dot org
  2009-03-30 23:35 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jason dot mcmullan at gmail dot com @ 2005-12-04 22:34 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"
  2005-12-04 20:26 [Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated" jason dot mcmullan at gmail dot com
  2005-12-04 22:32 ` [Bug target/25255] " jason dot mcmullan at gmail dot com
  2005-12-04 22:34 ` jason dot mcmullan at gmail dot com
@ 2005-12-06 23:55 ` pinskia at gcc dot gnu dot org
  2009-03-30 23:35 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-06 23:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-12-06 23:55 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-06 23:55:04
               date|                            |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/25255] packed structure: pointers to self result in "error: initializer for integer value is too complicated"
  2005-12-04 20:26 [Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated" jason dot mcmullan at gmail dot com
                   ` (2 preceding siblings ...)
  2005-12-06 23:55 ` pinskia at gcc dot gnu dot org
@ 2009-03-30 23:35 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rob1weld at aol dot com @ 2009-03-30 23:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rob1weld at aol dot com  2009-03-30 23:35 -------
I ran into this Bug on the Trunk for Platform x64_86-unknown-openbsd4.5 .


I tried the test "C" code from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25255#c1
and got this:

/home/user/gcc_build/test_gcc_2.c:18: error: initializer for
integer/fixed-point value is too complicated
/home/user/gcc_build/test_gcc_2.c:18: error: initializer for
integer/fixed-point value is too complicated


This error does not occur with gcc version 3.3.5 on:
# uname -a
OpenBSD openbsd.localdomain 4.5 GENERIC#5 amd64


# gcc/xgcc -v
Using built-in specs.
Target: amd64-unknown-openbsd4.5
Configured with: /usr/src/gcc_trunk/configure --prefix=/home/user/gcc_installed
--target=amd64-unknown-openbsd4.5 --enable-languages=c,c++ --disable-multilib
--enable-threads=posix --enable-static --enable-shared --with-gnu-ld
--with-gnu-as --with-long-double-128 --disable-stage1-checking
--enable-checking=release --with-gmp=/usr/local --with-mpfr=/usr/local
Thread model: posix
gcc version 4.5.0 20090330 (experimental) [trunk revision 145313] (GCC)


# gmake
...
/usr/src/gcc_trunk/libgcc/../gcc/unwind-dw2-fde.c:848: warning: dereferencing
type-punned pointer will break strict-aliasing rules
/home/user/gcc_build/./gcc/xgcc -B/home/user/gcc_build/./gcc/
-B/home/user/gcc_installed/amd64-unknown-openbsd4.5/bin/
-B/home/user/gcc_installed/amd64-unknown-openbsd4.5/lib/ -isystem
/home/user/gcc_installed/amd64-unknown-openbsd4.5/include -isystem
/home/user/gcc_installed/amd64-unknown-openbsd4.5/sys-include -g -O2 -O2  -g
-O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include 
-fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED   -I. -I.
-I../.././gcc -I/usr/src/gcc_trunk/libgcc -I/usr/src/gcc_trunk/libgcc/.
-I/usr/src/gcc_trunk/libgcc/../gcc -I/usr/src/gcc_trunk/libgcc/../include 
-DHAVE_CC_TLS -o unwind-sjlj.o -MT unwind-sjlj.o -MD -MP -MF unwind-sjlj.dep
-fexceptions -c /usr/src/gcc_trunk/libgcc/../gcc/unwind-sjlj.c
/home/user/gcc_build/./gcc/xgcc -B/home/user/gcc_build/./gcc/
-B/home/user/gcc_installed/amd64-unknown-openbsd4.5/bin/
-B/home/user/gcc_installed/amd64-unknown-openbsd4.5/lib/ -isystem
/home/user/gcc_installed/amd64-unknown-openbsd4.5/include -isystem
/home/user/gcc_installed/amd64-unknown-openbsd4.5/sys-include -g -O2 -O2  -g
-O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include 
-fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED   -I. -I.
-I../.././gcc -I/usr/src/gcc_trunk/libgcc -I/usr/src/gcc_trunk/libgcc/.
-I/usr/src/gcc_trunk/libgcc/../gcc -I/usr/src/gcc_trunk/libgcc/../include 
-DHAVE_CC_TLS -o gthr-gnat.o -MT gthr-gnat.o -MD -MP -MF gthr-gnat.dep
-fexceptions -c /usr/src/gcc_trunk/libgcc/../gcc/gthr-gnat.c
/usr/src/gcc_trunk/libgcc/../gcc/gthr-gnat.c:87: error: initializer for
integer/fixed-point value is too complicated
/usr/src/gcc_trunk/libgcc/../gcc/gthr-gnat.c:87: error: initializer for
integer/fixed-point value is too complicated
gmake[3]: *** [gthr-gnat.o] Error 1
gmake[3]: Leaving directory
`/home/user/gcc_build/amd64-unknown-openbsd4.5/libgcc'
gmake[2]: *** [all-stage1-target-libgcc] Error 2
gmake[2]: Leaving directory `/home/user/gcc_build'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/home/user/gcc_build'
gmake: *** [all] Error 2


Thanks,
Rob


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-30 23:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-04 20:26 [Bug c/25255] New: packed structure: pointers to self result in "error: initializer for integer value is too complicated" jason dot mcmullan at gmail dot com
2005-12-04 22:32 ` [Bug target/25255] " jason dot mcmullan at gmail dot com
2005-12-04 22:34 ` jason dot mcmullan at gmail dot com
2005-12-06 23:55 ` pinskia at gcc dot gnu dot org
2009-03-30 23:35 ` rob1weld at aol dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).