Subject: toolchain/32595: gcc/read-rtl.c: invalid lvalue in increment (gcc 4)
To: None <,,>
From: Magnus Henoch <>
List: netbsd-bugs
Date: 01/22/2006 13:00:00
>Number:         32595
>Category:       toolchain
>Synopsis:       gcc/read-rtl.c: invalid lvalue in increment (gcc 4)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 22 13:00:00 +0000 2006
>Originator:     Magnus Henoch
>Release:        NetBSD 3.99.14
System: NetBSD zemdatav 3.99.14 NetBSD 3.99.14 (IBOOKFAN) #25: Sun Dec 25 03:14:26 CET 2005 magnus@zemdatav:/usr/src/sys/arch/macppc/compile/IBOOKFAN macppc
Architecture: powerpc
Machine: macppc
	I'm trying to crosscompile NetBSD-current/macppc from an i386
	machine running Debian testing.  gcc --version gives:
gcc (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)

        I'm starting the build with:
./ -U -X ../xsrc -x -u -m macppc -O ../obj -T ../tools release

    	The build fails while compiling gcc:
cc -c    -O -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H -DGENERATOR_FILE -DNETBSD_TOOLS   -I. -I. -I/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc -I/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/.  -I/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/config -I/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/../include /home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c -o read-rtl.o
In file included from /home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c:24:
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/rtl.h:132: warning: type of bit-field 'code' is a GCC extension
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/rtl.h:135: warning: type of bit-field 'mode' is a GCC extension
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c: In function 'fatal_with_file_and_line':
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c:53: warning: traditional C rejects ISO C style function definitions
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c: In function 'read_rtx':
/home/magnus/netbsd-src/src/tools/gcc/../../gnu/dist/gcc/gcc/read-rtl.c:653: error: invalid lvalue in increment

	At it is said:
It's a problem.  Older versions of gcc use a construct which newer
versions of gcc won't compile.  This makes it hard to bootstrap older
versions of gcc with newer versions.  This is indeed an absurd

	Adapted from

Index: obstack.h
RCS file: /cvsroot/src/gnu/dist/gcc/include/obstack.h,v
retrieving revision
diff -u -r1.1.1.1 obstack.h
--- obstack.h   23 Jul 2003 02:42:35 -0000
+++ obstack.h   22 Jan 2006 12:41:15 -0000
@@ -423,7 +423,8 @@
 ({ struct obstack *__o = (OBSTACK);                                    \
    if (__o->next_free + sizeof (void *) > __o->chunk_limit)            \
      _obstack_newchunk (__o, sizeof (void *));                         \
-   *((void **)__o->next_free)++ = ((void *)datum);                     \
+   *((void **)__o->next_free) = ((void *)datum);                       \
+   __o->next_free += sizeof(void *);                                   \
    (void) 0; })

 # define obstack_int_grow(OBSTACK,datum)                               \