diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-08 06:46:04 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-08 06:46:04 +0000 |
commit | 8b29235c563e2f7d80708200d851a234416cab60 (patch) | |
tree | 1b1ef712806bd0b0506e27898f6b8a70596ba394 | |
parent | 7edd823de73e3ff95b79ec5f21f34d90a1362c8b (diff) | |
download | ppe42-gcc-8b29235c563e2f7d80708200d851a234416cab60.tar.gz ppe42-gcc-8b29235c563e2f7d80708200d851a234416cab60.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134013 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/cuintp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c index ba3ffa090b5..90ea342f6b5 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); |