I was trying to generate a minimum ada runtime library for the avr (e.g. at90s8535) by copying the required *.ads and *.adb files to <prefix>/lib/gcc-lib/avr/3.4/ada-include and compile them. What I got was a number of ICEs of the form: +===========================GNAT BUG DETECTED==============================+ | 3.4 20030509 (experimental) (avr-unknown-none) Gigi abort, Code=305 | | No source file position information available | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ The files which generated errors were: s-stalib.adb, s-parame.adb, i-c.adb, s-maccod.ads I ran the compilation with avr-gcc -c -gnatg <filename> flags -O and -mmcu=at90s8535 didn't make any difference In file s-maccod.ads the reason for the ICE was the line: pragma Import (Intrinsic, Asm); In file i-c.ads the reason for the crash is the definition of type long: type long is range -(2 ** (System.Parameters.long_bits - 1)) .. +(2 ** (System.Parameters.long_bits - 1)) - 1; Release: 3.4 20030509 Environment: host: linux-x86 (redhat 7.3)
Hello, your attachment to this bug report doesn't seem to have survived the bugzilla switchover. Can you please reattach the failing files? Thanks, Dara
Created attachment 4193 [details] file causing error the line "pragma Import (Intrinsic, Asm);" causes an ICE; this line is commented out in the attached file (line 119); $ avr-gcc-3.4 -c -gnatg s-maccod.ads +===========================GNAT BUG DETECTED==============================+ | 3.4 20030509 (experimental) (avr-unknown-none) Gigi abort, Code=305 | | No source file position information available | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. compilation abandoned
Created attachment 4194 [details] file causing error The attached file causes an error in lines 33,34 when compiling the body of this package. commenting out the type definition in these lines and inserting "type long is new Integer;" instead causes a warning but compiles without ICE. I will attach the package body file in a new attachment as I don't know how to get the form to accept multple file... BTW - can anybody tell me how to do this??? $ avr-gcc-3.4 -c -gnatg i-c.adb +===========================GNAT BUG DETECTED==============================+ | 3.4 20030509 (experimental) (avr-unknown-none) Gigi abort, Code=305 | | No source file position information available | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. compilation abandoned
Created attachment 4195 [details] file needed for compilation to create ICE
Changing to invalid to ...
change to unconfirmed.
This is really specific to the avr port, so you would need to talk with the avr maintainer on these issues. Apparently basic things such as support for long is not properly supported by the avr back end, and this is turn causes bug box in gnat. Arno
>This is really specific to the avr port, so you would need to talk with the >avr maintainer on these issues. >Apparently basic things such as support for long is not properly >supported by the avr back end, and this is turn causes bug box in gnat. Denis, would you please take a look in the avr back end? Maybe its easy to support 'long' properly.. Thanks, Bernd
Update: gcc-head fails with +===========================GNAT BUG DETECTED==============================+ | 4.0.0 20040917 (experimental) (avr-unknown-none) GCC error: | | in gnat_to_gnu, at ada/trans.c:2539 | | No source file position information available | compiling this: --------- t.ads ------------- package T is bug : Short_Integer; end T; --------- t.ads -------------
Bernd, does this still fail on the most recent HEAD? Eric
>Bernd, does this still fail on the most recent HEAD? Yes, it still fails: +===========================GNAT BUG DETECTED==============================+ | 4.0.0 20050213 (experimental) (avr-unknown-none) GCC error: | | in gnat_to_gnu, at ada/trans.c:2536 | compiling this: --------- t.ads ------------- package T is bug : Short_Integer; end T; --------- t.ads -------------
i-c.ad? use exceptions which are not supported on AVR anyhow. The compiler issues a corresponding error message with gcc-3.4.3, no ICE. s-maccod.ads compiles fine with gcc-3.4.3, no ICE. The problem mentioned in comments 9 - 11 is not related to the original problem. It deserves a separate entry in bugzilla. I propose to close this entry here.
*** Bug 26849 has been marked as a duplicate of this bug. ***
(In reply to comment #12) > It deserves a separate entry in bugzilla. > I propose to close this entry here. I did the opposite and closed the other as a dup, since the orginal testcase still fails with ICEs.
Bernd, Rolf, Can you verify if this bug still exists? If so, I have in my notes that this patch will fix this bug: <http://svn.sourceforge.net/viewvc/avr-ada/trunk/patches/gcc-4.1-integer-bug-workaround.patch?view=log> If so, can you attach the patch to this bug report? Thanks
(In reply to comment #15) > Can you verify if this bug still exists? Yes, the problem is still present in 4.2 Bernd Trog developed a workaround available at http://svn.sourceforge.net/viewvc/avr-ada/trunk/patches/gcc-4.1-integer-bug-workaround.patch?view=log (sorry, I cannot attach it due to an internal error of bugzilla) Also see the related discussion that started here http://gcc.gnu.org/ml/gcc/2006-04/msg00512.html PR 30501 is a duplicate of this bug report and could be closed.
*** Bug 30501 has been marked as a duplicate of this bug. ***
Created attachment 13597 [details] Bernd's patch that fixes the problem Bernd's patch as mentioned in comment #16
Just to clarify: the patch posted is only a workaround/kludge, not a real fix. Arno
Subject: RE: ICEs on compilation of ada support library for avr > -----Original Message----- > From: charlet at gcc dot gnu dot org > [mailto:gcc-bugzilla@gcc.gnu.org] > Sent: Tuesday, May 22, 2007 2:51 AM > To: eweddington@cso.atmel.com > Subject: [Bug target/10768] ICEs on compilation of ada > support library for avr > > > > ------- Comment #19 from charlet at gcc dot gnu dot org > 2007-05-22 09:51 ------- > Just to clarify: the patch posted is only a workaround/kludge, not a > real fix. > > Arno Then what would be a real fix that could actually be approved and committed? Eric Weddington
Subject: Re: ICEs on compilation of ada support library for avr > Then what would be a real fix that could actually be approved and committed? Fix support for long (or long long ?) in the avr back-end. Arno
Hello, when compiling the package package Integer_Test is type Int_Type is new Integer; end Integer_Test; the ICE occures when the GNAT node that represents the lower bound of the integer type is converted to the corresponding INTERGER_CST node. In the above case comp_type (gcc/ada/cuintp.c:87) represents a signed integer type with 16 bit precision which is to small for the computations performed later: The call to build_cst_from_int (Base = 32768) at line gcc/ada/cuintp.c:110 gnu_base = build_cst_from_int (comp_type, Base); returns an INTEGER_CST with the value -32768 which causes an overflow (and later the ICE) in the call to fold_build2 (MULT_EXPR, comp_type, gnu_ret, gnu_base) at line gcc/ada/cuintp.c:116. See patch below. Peter ------------------------------------------- diff -Naur gcc-4.3-20071214.ORIG/gcc/ada/cuintp.c gcc-4.3-20071214/gcc/ada/cuintp.c --- gcc-4.3-20071214.ORIG/gcc/ada/cuintp.c 2007-09-03 12:06:52.000000000 +0200 +++ gcc-4.3-20071214/gcc/ada/cuintp.c 2007-12-15 19:33:37.000000000 +0100 @@ -104,8 +104,8 @@ convert the final result back to the incoming type later on. */ if (TREE_CODE (comp_type) != REAL_TYPE - && TYPE_PRECISION (comp_type) < TYPE_PRECISION (integer_type_node)) - comp_type = integer_type_node; + && TYPE_PRECISION (comp_type) < TYPE_PRECISION (long_integer_type_node)) + comp_type = long_integer_type_node; gnu_base = build_cst_from_int (comp_type, Base);
Subject: Bug 10768 Author: charlet Date: Tue Apr 8 06:46:04 2008 New Revision: 134013 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134013 Log: 2008-04-08 Tristan Gingold <gingold@adacore.com> PR ada/10768 * cuintp.c: Fix 16 bits issue for AVR. On AVR, integer is 16 bits, so it can't be used to do math with Base (=32768). So use long_integer instead. Modified: trunk/gcc/ada/cuintp.c
Fixed on mainline.