This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
(not) building gpc 19991030 on /alpha [patch]
- From: levi at localhost dot nc3a dot nato dot int
- To: levi at localhost dot nc3a dot nato dot int
- Cc: gcc at gcc dot gnu dot org
- Date: 08 Nov 1999 06:05:13 -0200
- Subject: (not) building gpc 19991030 on /alpha [patch]
- Mail-from: owner-gpc@gnu.de Mon Nov 8 15:32:28 1999
Hi!
I'd never been able to build gpc on any alpha host: gpc1 would ICE
while building a couple of files within gcc/p/rts, for example,
error.pas. Tonight, I decided to try to track the problem down.
First, I tried to come up with a minimal testcase that reproduced the
problem:
program Error;
var e : array [0 .. 0] of CString;
i : Integer;
begin
e [i] := '';
end.
The problem was that, while expanding the ARRAY_REF,
get_inner_reference() would build a MULT_EXPR with type ssizetype
(SImode), but the index type was sizetype (DImode). Since there was
no intervening convert(), expand_mult would call
copy_to_mode_reg(SImode, a_DImode_register), that would abort().
The problem was that ssizetype was not being properly initialized so
as to match sizetype, and it's fixed with the following patch, that
matches the corresponding section of c-decl.c as of gcc 2.95.2 and
current CVS:
Index: gcc/p/ChangeLog
from Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* gpc-decl.c (init_decl_processing): Use set_sizetype instead of
assigning to sizetype.
Index: gcc/p/gpc-decl.c
--- gcc/p/gpc-decl.c Sat Oct 30 17:23:45 1999
+++ gcc/p/gpc-decl.c Mon Nov 8 05:32:46 1999
@@ -4265,10 +4265,10 @@
Traditionally, use a signed type.
Note that stddef.h uses `unsigned long',
and this must agree, even of long and int are the same size. */
- sizetype
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (GET_IDENTIFIER (SIZE_TYPE)));
+ set_sizetype
+ (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (GET_IDENTIFIER (SIZE_TYPE))));
if (flag_traditional && TREE_UNSIGNED (sizetype))
- sizetype = signed_type (sizetype);
+ set_sizetype (signed_type (sizetype));
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (GET_IDENTIFIER (PTRDIFF_TYPE)));
I'm Cc:ing the gcc mailing list because I thought we could have
helped avoid this problem:
- we could arrange that sizetype is no longer an lvalue, so that only
set_sizetype would assign to it, and misuses would get a compile-time
error instead of a run-time crash only on platforms with
ssize_t == long == DImode and int == SImode.
- in the code snippet below, from expr.c:get_inner_reference(), we
could explicitly convert index to ssizetype. AFAICT, fold would drop
the conversion if it found it needless.
/* Either the bit offset calculated above is not constant, or
it overflowed. In either case, redo the multiplication
against the size in units. This is especially important
in the non-constant case to avoid a division at runtime. */
xindex = fold (build (MULT_EXPR, ssizetype, index,
convert (ssizetype,
TYPE_SIZE_UNIT (TREE_TYPE (exp)))));
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them