This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] Bootstrapping mainline GNAT fails
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: dewar at gnat dot com, gcc at gcc dot gnu dot org
- Date: Mon, 18 Mar 2002 19:26:31 -0800
- Subject: Re: [Ada] Bootstrapping mainline GNAT fails
- References: <10203190227.AA10046@vlsi1.ultra.nyu.edu>
On Mon, Mar 18, 2002 at 09:27:34PM -0500, Richard Kenner wrote:
> It's really hard to guess what is going on here. Especially since we
> don' t duplicate this bomb. I wonder what is different about your
> setup and ours?
>
> I'm guessing this is compiling snames.adb and I think we *do* take the
> exception here, which is a latent bug.
namet.adb, actually.
> The real problem is that builtin setjmp/longjmp seems to be broken.
>
> Zack, try compiling and running the following with the same compiler you
> built gnat1 with:
[snip]
Seems to work fine:
$ gnatgcc -v test.c
Reading specs from /usr/lib/gcc-lib/i486-linux/2.8.1/specs
gcc version 2.8.1
/usr/lib/gcc-lib/i486-linux/2.8.1/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Di386 -Di486 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i486__ -Asystem(unix) -Acpu(i386) -Amachine(i386) test.c /tmp/cczTwt0P.i
GNU CPP version 2.8.1 (i386 GNU/Linux with ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i486-linux/2.8.1/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i486-linux/2.8.1/cc1 /tmp/cczTwt0P.i -quiet -dumpbase test.c -version -o /tmp/cczTwt0P.s
GNU C version 2.8.1 (i486-linux) compiled by GNU C version 2.8.1.
as -V -Qy -o /tmp/cczTwt0P1.o /tmp/cczTwt0P.s
GNU assembler version 2.11.93.0.2 (i386-linux) using BFD version 2.11.93.0.2 20020207 Debian/GNU Linux
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i486-linux/2.8.1/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/2.8.1 /tmp/cczTwt0P1.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i486-linux/2.8.1/crtend.o /usr/lib/crtn.o
$ ./a.out ; echo $?
test
0
Same with 2.95.4.
I'm giving this patch for sem_eval.adb a whirl right now. It works
for compiling namet.adb under GDB; more later.
zw
===================================================================
Index: ada/sem_eval.adb
--- ada/sem_eval.adb 2002/03/14 11:00:12 1.5
+++ ada/sem_eval.adb 2002/03/19 03:24:12
@@ -817,13 +817,6 @@ package body Sem_Eval is
-- If we fall through, not known at compile time
return False;
-
- -- If we get an exception while trying to do this test, then some error
- -- has occurred, and we simply say that the value is not known after all
-
- exception
- when others =>
- return False;
end Compile_Time_Known_Value;
--------------------------------------
@@ -921,20 +914,28 @@ package body Sem_Eval is
declare
Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op)));
Sub : constant Node_Id := First (Expressions (Op));
- Ind : constant Node_Id := First_Index (Etype (Arr));
- Lbd : constant Node_Id := Type_Low_Bound (Etype (Ind));
+ Aty : constant Node_Id := Etype (Arr);
Lin : Nat;
-- Linear one's origin subscript value for array reference
+ Lbd : Node_Id;
+ -- Lower bound of the first array index
+
Elm : Node_Id;
-- Value from constant array
begin
+ if Ekind (Aty) = E_String_Literal_Subtype then
+ Lbd := String_Literal_Low_Bound (Aty);
+ else
+ Lbd := Type_Low_Bound (Etype (First_Index (Aty)));
+ end if;
+
if Compile_Time_Known_Value (Sub)
and then Nkind (Arr) = N_Aggregate
and then Compile_Time_Known_Value (Lbd)
- and then Is_Discrete_Type (Component_Type (Etype (Arr)))
+ and then Is_Discrete_Type (Component_Type (Aty))
then
Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1;