https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101970
Bug ID: 101970 Summary: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: demoonlit at panathenaia dot halfmoon.jp Target Milestone: --- Created attachment 51322 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51322&action=edit full test code Perhaps this is a regression by fixing the bug 101094. 'Enum_Rep causes GNAT bug Box, with the enum type containing the number of elements to fill just its (signed?) representation range. Thanks. #### test code #### Here is the abbreviated test code. The full code is attached. with Ada.Integer_Text_IO; with Ada.Text_IO; procedure test_enumrep2 is type T is (E80, ..., E00, ..., E7F); -- 256 elements for T use (E80 => -16#80#, ..., E00 => 16#00#, ..., E7F => 16#7F#); -- -128 to +127 for T'Size use 8; procedure P (X : T); pragma No_Inline (P); procedure P (X : T) is begin Ada.Integer_Text_IO.Put (T'Pos (X)); Ada.Integer_Text_IO.Put (T'Enum_Rep (X)); -- GNAT BUG DETECTED Ada.Text_IO.New_Line; end P; begin P (T'First); P (T'Last); end test_enumrep2; #### gcc-10.2.0 #### % /opt/ytomino/gcc-10.2.0/bin/gnatmake --version GNATMAKE 10.2.0 Copyright (C) 1995-2020, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % /opt/ytomino/gcc-10.2.0/bin/gnatmake test_enumrep2.adb gcc -c test_enumrep2.adb gnatbind -x test_enumrep2.ali gnatlink test_enumrep2.ali % ./test_enumrep2 0 -128 255 127 It's fine. #### gcc-11.1.0 #### % /opt/ytomino/gcc-11.1.0/bin/gnatmake --version GNATMAKE 11.1.0 Copyright (C) 1995-2021, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % /opt/ytomino/gcc-11.1.0/bin/gnatmake test_enumrep2.adb gcc -c test_enumrep2.adb gnatbind -x test_enumrep2.ali gnatlink test_enumrep2.ali % ./test_enumrep2 0 128 255 127 Note, T'Enum_Rep(T'First) returns the unsigned value in gcc-11.1 because bug 101094. #### gcc-11.2.0 #### % /opt/ytomino/gcc-11.2.0/bin/gnatmake --version GNATMAKE 11.2.0 Copyright (C) 1995-2021, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % /opt/ytomino/gcc-11.2.0/bin/gnatmake test_enumrep2 gcc -c test_enumrep2.adb +===========================GNAT BUG DETECTED==============================+ | 11.2.0 (x86_64-linux-gnu) GCC error: | | in build_binary_op, at ada/gcc-interface/utils2.c:1164 | | Error detected at test_enumrep2.adb:107:44 | | Please submit a bug report; see https://gcc.gnu.org/bugs/ . | | Use a subject line meaningful to you and us to track the bug. | | Include the entire contents of this bug box in the report. | | Include the exact command that you entered. | | Also include sources listed below. | +==========================================================================+ Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. Consider also -gnatd.n switch (see debug.adb). test_enumrep2.adb compilation abandoned gnatmake: "test_enumrep2.adb" compilation error