diff options
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/integer_value.ads | 5 |
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7b7383c..c763515 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -17,6 +17,11 @@ * 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++ diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 9821b6f..1a0b0c8 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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); ----------- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 692ca74..95b437b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..6e9c1b5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/integer_value.ads @@ -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; |