re PR ada/32792 (Assert_Failure sinfo.adb:1730)
authorSamuel Tardieu <sam@rfc1149.net>
Wed, 28 Nov 2007 20:46:18 +0000 (20:46 +0000)
committerSamuel Tardieu <sam@gcc.gnu.org>
Wed, 28 Nov 2007 20:46:18 +0000 (20:46 +0000)
    gcc/ada/
PR ada/32792
* sem_attr.adb (Analyze_Attribute, Attribute_Integer_Value clause):
Signal an error when attribute argument is a fixed-point value of
an unknown type.

    gcc/testsuite/
PR ada/32792
* gnat.dg/specs/integer_value.ads: New test.

From-SVN: r130497

gcc/ada/ChangeLog
gcc/ada/sem_attr.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/integer_value.ads [new file with mode: 0644]

index 7b7383cf96def2d377abda40dadbd76c68ce5294..c7635154fd825bca4845e42393e1d544d7126c0f 100644 (file)
 
        * snames.ads (Attribute_Class_Array): Moved from sem-attr.ads.
 
+       PR ada/32792
+       * sem_attr.adb (Analyze_Attribute, Attribute_Integer_Value clause):
+       Signal an error when attribute argument is a fixed-point value of
+       an unknown type.
+
 2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
 
         PR 34081/C++
index 9821b6f10c3367c0554cb9a76d9f5bb3842285bd..1a0b0c82d4faf296dbf5cf22a564d21ebbd3009f 100644 (file)
@@ -2975,6 +2975,15 @@ package body Sem_Attr is
          Check_E1;
          Check_Integer_Type;
          Resolve (E1, Any_Fixed);
+
+         --  Signal an error if argument type is not a specific fixed-point
+         --  subtype. An error has been signalled already if the argument
+         --  was not of a fixed-point type.
+
+         if Etype (E1) = Any_Fixed and then not Error_Posted (E1) then
+            Error_Attr ("argument of % must be of a fixed-point type", E1);
+         end if;
+
          Set_Etype (N, P_Base_Type);
 
       -----------
index 692ca74a395b05e8445ec8f5ce5c803ab117811e..95b437bbbbce3dfc7b388b5890123ef9d0406e4a 100644 (file)
@@ -6,6 +6,9 @@
        PR ada/17317
        * gnat.dg/specs/attribute_parsing.ads: New test.
 
+       PR ada/32792
+       * gnat.dg/specs/integer_value.ads: New test.
+
 2007-11-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/34140
diff --git a/gcc/testsuite/gnat.dg/specs/integer_value.ads b/gcc/testsuite/gnat.dg/specs/integer_value.ads
new file mode 100644 (file)
index 0000000..6e9c1b5
--- /dev/null
@@ -0,0 +1,5 @@
+-- { dg-do compile }
+package Integer_Value is
+   X : constant Integer :=
+     Integer'Integer_Value (12.8); -- { dg-error "fixed-point type" "" }
+end Integer_Value;