The static dispatch tables of library-level tagged types are either built on the first object declaration or at the end of the declarative part of the package spec or body. There is no real need for the former case, and the tables are not built for other constructs that freeze (tagged) types. Therefore this change removes the former case, thus causing the tables to be always built at the end of the declarative part; that's orthogonal to freezing and the tagged types are still frozen at the appropriate place. Moreover, it wraps the code in the Actions list of a freeze node (like for the nonstatic case) so that it is considered elaboration code by the processing done in Sem_Elab and does not disturb it. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Expand_Freeze_Record_Type): Adjust comment. (Expand_N_Object_Declaration): Do not build static dispatch tables. * exp_disp.adb (Make_And_Insert_Dispatch_Table): New procedure. (Build_Static_Dispatch_Tables): Call it to build the dispatch tables and wrap them in the Actions list of a freeze node.