From f9a4f2ef03bc9ad213e82e40b4c26fc0d33b1a94 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 8 Apr 2008 08:46:04 +0200 Subject: [PATCH] re PR target/10768 (ICEs on compilation of ada support library for avr) 2008-04-08 Tristan Gingold 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. From-SVN: r134013 --- gcc/ada/cuintp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c index ba3ffa0..90ea342 100644 --- a/gcc/ada/cuintp.c +++ b/gcc/ada/cuintp.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -101,11 +101,15 @@ UI_To_gnu (Uint Input, tree type) large as an integer not to overflow. REAL types are always fine, but INTEGER or ENUMERAL types we are handed may be too short. We use a base integer type node for the computations in this case and will - convert the final result back to the incoming type later on. */ + convert the final result back to the incoming type later on. + The base integer precision must be superior than 16. */ 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; + gcc_assert (TYPE_PRECISION (comp_type) > 16); + } gnu_base = build_cst_from_int (comp_type, Base); -- 2.7.4