https://gcc.gnu.org/g:5621e907ffbfc5953568d90c14c0f57d871e8f59
commit r15-1780-g5621e907ffbfc5953568d90c14c0f57d871e8f59 Author: Steve Baird <ba...@adacore.com> Date: Thu Jun 13 15:18:31 2024 -0700 ada: Compiler accepts an illegal Unchecked_Access attribute reference The compiler incorrectly accepts Some_Object'Unchecked_Access'Image. gcc/ada/ * sem_attr.adb (Analyze_Image_Attribute.Check_Image_Type): Check for E_Access_Attribute_Type prefix type. Diff: --- gcc/ada/sem_attr.adb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index d56c25a79cc..0b0adac1126 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1582,6 +1582,13 @@ package body Sem_Attr is then Error_Msg_Ada_2022_Feature ("nonscalar ''Image", Sloc (P)); Error_Attr; + + elsif Present (Image_Type) + and then Ekind (Image_Type) = E_Access_Attribute_Type + then + -- reject Some_Object'[Unchecked_]Access'[Wide_[Wide_]]Image + Error_Msg_N ("illegal Image attribute prefix", N); + Error_Attr; end if; end Check_Image_Type;