]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Crash on call to a dispatching op with if_expr and tag-indeterminate calls
authorGary Dismukes <dismukes@adacore.com>
Thu, 16 Oct 2025 21:38:38 +0000 (21:38 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:17 +0000 (15:15 +0100)
commit4ff0bd5f98728d14a91d62d44fe1fa4bdd0bee33
tree475230740a4197e68995e4caad0b7f684d4c423f
parent2c77eeb8d823982c412fbc5f9aaeec7735cc7ed6
ada: Crash on call to a dispatching op with if_expr and tag-indeterminate calls

The compiler can crash with a Storage_Error for a failed precondition
when compiling a call to a dispatching subprogram where an actual for a
controlling formal is given by an if_expression whose dependent expressions
are tag-indeterminate calls.  This problem showed up on a build of Alire
(on the compilation of alire-roots.adb) done during a build_gnat_world
mailserver (as well as having been noticed and reported separately by
another engineering team).

The code in Sem_Disp.Check_Dispatching_Call for checking nondispatching
procedure calls for actuals that are calls to abstract tag-indeterminate
functions did not account for conditional expressions, and attempted to
retrieve the (nonexistent) Expression field from an N_If_Expression node,
failing the precondition for Expression.  It was discovered that none of
the code checking for illegal calls to abstract tag-indeterminate functions
in procedure calls is needed, and the whole related "elsif" part is removed
by this change.  (Note that there is separate checking done separately
within Check_Dispatching_Call that will catch nondispatching calls to
abstract functions.)

gcc/ada/ChangeLog:

* sem_disp.adb (Check_Dispatching_Call): Remove "elsif" that does error
checking for abstract tag-indeterminate calls (seems to be no longer
needed).
gcc/ada/sem_disp.adb