2008-05-26 Robert Dewar <dewar@adacore.com>
authorRobert Dewar <dewar@adacore.com>
Mon, 26 May 2008 09:41:03 +0000 (11:41 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 26 May 2008 09:41:03 +0000 (11:41 +0200)
* exp_ch2.adb:
(Expand_Current_Value): Properly type generated integer literal

From-SVN: r135904

gcc/ada/exp_ch2.adb

index 6093f2a73337c1f7c26e4828677fc73aa5a617e9..3825405dccf1ed6ac584290be2421153482a02f3 100644 (file)
@@ -193,13 +193,21 @@ package body Exp_Ch2 is
               Unchecked_Convert_To (T,
                 New_Occurrence_Of (Entity (Val), Loc)));
 
-         --  Otherwise get the value, and convert to appropriate type
+         --  If constant is of an integer type, just make an appropriately
+         --  integer literal, which will get the proper type.
+
+         elsif Is_Integer_Type (T) then
+            Rewrite (N,
+              Make_Integer_Literal (Loc,
+                Intval => Expr_Rep_Value (Val)));
+
+         --  Otherwise do unchecked conversion of value to right type
 
          else
             Rewrite (N,
               Unchecked_Convert_To (T,
-                Make_Integer_Literal (Loc,
-                  Intval => Expr_Rep_Value (Val))));
+                 Make_Integer_Literal (Loc,
+                   Intval => Expr_Rep_Value (Val))));
          end if;
 
          Analyze_And_Resolve (N, T);