This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

(not) building gpc 19991030 on /alpha [patch]


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

program Error;

var e : array [0 .. 0] of CString;
    i : Integer;
	e [i] := '';

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

	* 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
+  set_sizetype
   if (flag_traditional && TREE_UNSIGNED (sizetype))
-    sizetype = signed_type (sizetype);
+    set_sizetype (signed_type (sizetype));

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 IC-Unicamp, Bra[sz]il
oliva@{,guarana.{org,com}} aoliva@{acm,computer}.org
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]