This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/10768] ICEs on compilation of ada support library for avr
- From: "linux at schildmann dot info" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Dec 2007 19:53:16 -0000
- Subject: [Bug target/10768] ICEs on compilation of ada support library for avr
- References: <bug-10768-282@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #22 from linux at schildmann dot info 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);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10768