]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: sem.adb.process_bodies_in_context: check if spec has lib body before use
authorGhjuvan Lacambre <lacambre@adacore.com>
Fri, 18 Oct 2024 14:15:04 +0000 (16:15 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 12 Nov 2024 13:00:45 +0000 (14:00 +0100)
commitca0f0154622c32123c57721b39bc9585119b02d7
tree493caeec0ccacd5c5dbda90504cc220e31ae1613
parentea497d17c11ee7465140aa13a18a0033ba5a2a27
ada: sem.adb.process_bodies_in_context: check if spec has lib body before use

Inspector testing shows that calling Body_Lib_Unit on Spec can sometimes
fail due to the following assertion failing:

            pragma Assert
              (Unit (N) in N_Lib_Unit_Declaration_Id
                | N_Lib_Unit_Renaming_Declaration_Id);

Indeed, Unit (N) may sometimes be an N_Subprogram_Body instead of an
N_Lib_Unit_Declaration_Id.

gcc/ada/ChangeLog:

* sem.adb (Process_Bodies_In_Context): check that Spec's unit is
an N_Lib_Unit_Declaration_Id.
gcc/ada/sem.adb