pragma Ada_83; procedure Test_251265(x: integer) is begin case x is when integer'last +1 => null; when 0 => null; -- line 5 when others => null; end case; end Test_251265; $ gnatmake -q -O1 test_251265 +===========================GNAT BUG DETECTED==============================+ | 3.15p (20020523) (i486-pc-linux-gnu) Gigi abort, Code=316 | | Error detected at test_251265.adb:4:9 | | Please submit bug report by email to report@gnat.com. | | Use a subject line meaningful to you and us to track the bug. | | (include your customer number #nnn in the subject line). | | Include the entire contents of this bug box in the report. | | Include the exact gnatgcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | | (use plain ASCII or MIME attachment, or FTP to your customer directory). | | See README.GNATPRO for full info on procedure for submitting bugs. | +==========================================================================+ Please include these source files with error report test_251265.adb compilation abandoned gnatmake: "test_251265.adb" compilation error
Sorry, it's late. Here is the error message from 3.4: +===========================GNAT BUG DETECTED==============================+ | 3.4.0 (Debian) (i486-pc-linux-gnu) Gigi abort, Code=316 | | Error detected at test_251265.adb:4:9 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc-3.4 or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ 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. test_251265.adb compilation abandoned gnatmake: "test_251265.adb" compilation error
Confirmed on the mainline: +===========================GNAT BUG DETECTED==============================+ | 4.0.0 20041012 (experimental) (powerpc-apple-darwin7.4.1) GCC error: | | in Case_Statement_to_gnu, at /ada/trans.c:1189 | | Error detected at test_251265.adb:4:9 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +============================================================== ============+
Lowering priority: opened more than 4 years ago, concerns Ada 83, pathological case. +===========================GNAT BUG DETECTED==============================+ | 4.4.0 20081021 (experimental) (x86_64-unknown-linux-gnu) GCC error: | | in Case_Statement_to_gnu, at ada/gcc-interface/trans.c:1626 | | Error detected at test_251265.adb:4:9 |
found 4.6.1
4.9.0 20140218 (experimental) [trunk rev 207856] (x86_64-linux-gnu) GCC error: in Case_Statement_to_gnu, at ada/gcc-interface/trans.c:2345 Error detected at test_106.adb:4:9
This is fixed in the trunk. It says: $ ./xgcc -B./ -Iada/rts/ -c -O1 /l/tmp/build/gcc/trunk/obj-x86_64-linux-gnu/gcc/test_251265.adb test_251265.adb:5:12: choice given in case statement is not static test_251265.adb:5:25: warning: value not in range of type "Standard.Integer" test_251265.adb:5:25: warning: "Constraint_Error" will be raised at run time test_251265.adb:5:25: expression raises exception, cannot be static (RM 4.9(34)) $ ./xgcc --version xgcc (GCC) 5.0.0 20150102 (experimental) [trunk revision ae61c50:a5fe274:4df12aa29efd9950b5bcbe15c207e61e11c16435]