Subject: expr.c: large structure problems
To: None <Haj.Ten.Brugge@net.HCC.nl>
From: Castor Fu <castor@geocast.net>
List: tech-toolchain
Date: 10/26/1998 16:29:24
The delta introduced in revision 1.76 of egcs/gcc/expr.c causes an
internal compiler error in cc1 built with a target of mips-dec-netbsd
and a host of i386-unknown-freebsd on the following code fragment:
struct biggy {
char buf[32800]; /* len > 16 bit offset */
char len [10 ];
};
static
void f ( struct biggy * s, int v)
{
s->len[v] = 13 ;
}
I haven't sorted out exactly why, and apparently this problem does not
show up in native mips environments. Since your name is listed in
the ChangeLog file, I would appreciate it if you could look into this.
It appears that the code is very localized, so it's easy to workaround,
but I'm not familiar enough with GCC to sort out the fix quickly myself.
Regards,
Castor Fu
p.s. I've appended copies of the relevant delta, and the error from my
compiler.
>----------------------------
>revision 1.76
>date: 1998/06/24 22:40:29; author: law; state: Exp; lines: +41 -0
> * expr.c (expand_assignment): Rework address calculation for structure
> field members to expose more invariant computations to the loop
> optimizer.
> (expand_expr): Likewise.
Index: expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/expr.c,v
retrieving revision 1.76
retrieving revision 1.75
diff -c -r1.76 -r1.75
*** expr.c 1998/06/24 22:40:29 1.76
--- expr.c 1998/06/24 14:49:45 1.75
***************
*** 2920,2945 ****
#endif
}
- if (GET_CODE (to_rtx) == MEM
- && GET_MODE (to_rtx) == BLKmode
- && bitsize
- && (bitpos % bitsize) == 0
- && (bitsize % GET_MODE_ALIGNMENT (mode1)) == 0
- && (alignment * BITS_PER_UNIT) == GET_MODE_ALIGNMENT (mode1))
- {
- rtx temp = change_address (to_rtx, mode1,
- plus_constant (XEXP (to_rtx, 0),
- (bitpos /
- BITS_PER_UNIT)));
- if (GET_CODE (XEXP (temp, 0)) == REG)
- to_rtx = temp;
- else
- to_rtx = change_address (to_rtx, mode1,
- force_reg (GET_MODE (XEXP (temp, 0)),
- XEXP (temp, 0)));
- bitpos = 0;
- }
-
to_rtx = change_address (to_rtx, VOIDmode,
gen_rtx_PLUS (ptr_mode, XEXP (to_rtx, 0),
force_reg (ptr_mode, offset_rtx)));
--- 2920,2925 ----
***************
*** 5937,5963 ****
offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
#endif
}
-
- if (GET_CODE (op0) == MEM
- && GET_MODE (op0) == BLKmode
- && bitsize
- && (bitpos % bitsize) == 0
- && (bitsize % GET_MODE_ALIGNMENT (mode1)) == 0
- && (alignment * BITS_PER_UNIT) == GET_MODE_ALIGNMENT (mode1))
- {
- rtx temp = change_address (op0, mode1,
- plus_constant (XEXP (op0, 0),
- (bitpos /
- BITS_PER_UNIT)));
- if (GET_CODE (XEXP (temp, 0)) == REG)
- op0 = temp;
- else
- op0 = change_address (op0, mode1,
- force_reg (GET_MODE (XEXP (temp, 0)),
- XEXP (temp, 0)));
- bitpos = 0;
- }
-
op0 = change_address (op0, VOIDmode,
gen_rtx_PLUS (ptr_mode, XEXP (op0, 0),
--- 5917,5922 ----
Reading specs from /geo/src/netbsd-1.3/src/buildenv/lib/gcc-lib/mips-geocast-elfbsd/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
/geo/src/netbsd-1.3/src/buildenv/lib/gcc-lib/mips-geocast-elfbsd/egcs-2.91.57/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ANSI_COMPAT -DMIPSEB -DR4000 -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -D__ELF__ -Dmips -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ -D_R3000 -D__ANSI_COMPAT -D__MIPSEB__ -D__R4000__ -D__R3000__ -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__NetBSD__ -D__ELF__ -D__mips__ -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ -D_R3000 -D__MIPSEB -D__R4000 -D__R3000 -D__SYSTYPE_BSD -D__mips -Asystem(unix) -Asystem(NetBSD) -Amachine(mips) -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int bug.c bug.i
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) [AL 1.1, MM 40] BSD Mips
#include "..." search starts here:
#include <...> search starts here:
/geo/src/netbsd-1.3/src/buildenv/lib/gcc-lib/mips-geocast-elfbsd/egcs-2.91.57/include
/geo/src/netbsd-1.3/src/buildenv/mips-geocast-elfbsd/sys-include
/geo/src/netbsd-1.3/src/buildenv/mips-geocast-elfbsd/include
End of search list.
/geo/src/netbsd-1.3/src/buildenv/lib/gcc-lib/mips-geocast-elfbsd/egcs-2.91.57/cc1 bug.i -mabicalls -quiet -dumpbase bug.c -version -o bug.s
GNU C version egcs-2.91.57 19980901 (egcs-1.1 release) (mips-geocast-elfbsd) compiled by GNU C version egcs-2.90.27 980315 (egcs-1.0.2 release).
bug.c: In function `f':
bug.c:10: internal error--unrecognizable insn:
(insn 14 12 16 (set (reg:SI 81)
(plus:SI (reg:SI 80)
(const_int 32800))) -1 (nil)
(nil))
/geo/src/netbsd-1.3/src/usr/src/gnu/dist/gcc/toplev.c:1360: Internal compiler error in function fatal_insn