Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 10768
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: maierkom@rcs.ei.tum.de
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
s-maccod.ads file causing error text/plain 2003-06-10 12:03 1.40 KB Edit
i-c.ads file causing error text/plain 2003-06-10 12:15 1.17 KB Edit
i-c.adb file needed for compilation to create ICE text/plain 2003-06-10 12:16 2.12 KB Edit
gcc-4.1-integer-bug-workaround.patch Bernd's patch that fixes the problem patch 2007-05-21 20:35 639 bytes Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 10768 depends on: Show dependency tree
Show dependency graph
Bug 10768 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2005-07-15 21:24 Opened: 2003-05-13 12:06
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)

------- Comment #1 From Dara Hazeghi 2003-05-31 18:24 -------
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

------- Comment #2 From maierkom@rcs.ei.tum.de 2003-06-10 12:03 -------
Created an attachment (id=4193) [edit]
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

------- Comment #3 From maierkom@rcs.ei.tum.de 2003-06-10 12:15 -------
Created an attachment (id=4194) [edit]
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

------- Comment #4 From maierkom@rcs.ei.tum.de 2003-06-10 12:16 -------
Created an attachment (id=4195) [edit]
file needed for compilation to create ICE

------- Comment #5 From Andrew Pinski 2003-07-19 04:11 -------
Changing to invalid to ...

------- Comment #6 From Andrew Pinski 2003-07-19 04:12 -------
change to unconfirmed.

------- Comment #7 From Arnaud Charlet 2003-10-22 09:08 -------
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

------- Comment #8 From berndtrog@yahoo.com 2003-11-13 20:03 -------
>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

------- Comment #9 From berndtrog@yahoo.com 2004-10-06 17:03 -------
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 -------------

------- Comment #10 From Eric Weddington 2005-02-11 19:38 -------
Bernd, does this still fail on the most recent HEAD?

Eric

------- Comment #11 From berndtrog@yahoo.com 2005-02-14 20:02 -------
>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 -------------

------- Comment #12 From Rolf Ebert 2005-02-28 23:52 -------
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.

------- Comment #13 From Andrew Pinski 2006-04-26 20:40 -------
*** Bug 26849 has been marked as a duplicate of this bug. ***

------- Comment #14 From Andrew Pinski 2006-04-26 20:42 -------
(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.

------- Comment #15 From Eric Weddington 2007-04-11 04:20 -------
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

------- Comment #16 From Rolf Ebert 2007-04-30 09:57 -------
(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.

------- Comment #17 From Arnaud Charlet 2007-04-30 09:59 -------
*** Bug 30501 has been marked as a duplicate of this bug. ***

------- Comment #18 From Rolf Ebert 2007-05-21 20:35 -------
Created an attachment (id=13597) [edit]
Bernd's patch that fixes the problem

Bernd's patch as mentioned in comment #16

------- Comment #19 From Arnaud Charlet 2007-05-22 09:51 -------
Just to clarify: the patch posted is only a workaround/kludge, not a
real fix.

Arno

------- Comment #20 From Eric Weddington 2007-05-22 14:24 -------
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

------- Comment #21 From charlet@adacore.com 2007-05-22 14:26 -------
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

------- Comment #22 From Peter Schildmann 2007-12-17 19:53 -------
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);

------- Comment #23 From Arnaud Charlet 2008-04-08 06:46 -------
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

------- Comment #24 From Arnaud Charlet 2008-04-08 07:25 -------
Fixed on mainline.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug