]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Rtsfind should not trash state used in analyzing instantiations.
authorSteve Baird <baird@adacore.com>
Wed, 7 Feb 2024 19:47:22 +0000 (11:47 -0800)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 14 May 2024 08:19:52 +0000 (10:19 +0200)
commitb2453909f68aa3e6810e4995bdcb0a555aab3902
tree3f87ba1881a168748b799f9400a9d7c3e52eb71c
parentcad2744cb385413d4762057a19f972fcb74233d6
ada: Rtsfind should not trash state used in analyzing instantiations.

During analysis of an instantiation, Sem_Ch12 manages formal/actual binding
information in package state (see Sem_Ch12.Generic_Renamings_HTable).
A call to rtsfind can cause another unit to be loaded and compiled.
If this occurs during the analysis of an instantiation, and if the loaded
unit contains a second instantiation, then the Sem_Ch12 state needed for
analyzing the first instantiation can be trashed during the analysis of the
second instantiation. Rtsfind calls that can include the analysis of an
instantiation need to save and restore Sem_Ch12's state.

gcc/ada/

* sem_ch12.ads: Declare new Instance_Context package, which
declares a private type Context with operations Save_And_Reset and
Restore.
* sem_ch12.adb: Provide body for new Instance_Context package.
* rtsfind.adb (Load_RTU): Wrap an Instance_Context Save/Restore
call pair around the call to Semantics.
* table.ads: Add initial value for Last_Val (because
Save_And_Reset expects Last_Val to be initialized).
gcc/ada/rtsfind.adb
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch12.ads
gcc/ada/table.ads