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