> This is the second go at this patch, and now with a testcase! > > In summary: > > If the type is derived in the current compilation unit, and Allocate is not > overridden on derivation (as is typically the case with > Root_Storage_Pool_With_Subpools), the entity for Allocate for the derived > type is then an alias to System.Storage_Pools.Subpools.Allocate. When the > allocator is built, gnat_to_gnu_entity is called with definition == false > for the derived storage pool's allocate operation. An assertion is > gnat_to_gnu_entity fails in this case, since it is not a definition, and > Is_Public is false (since the entity is nested in the same compilation > unit). > > This patch adds an extra check in the assertion (decl.c: gnat_to_gnu_entity) > that the entity has the Aliased property, and that the Alias is also > Public.
Thanks for the analysis and the fix. This has indeed apparently never worked and could be the origin of a few Ada PRs in Bugzilla, although I didn't really check that. The patch is obviously very safe so I have installed it on the mainline and the 9 branch (after slightly trimming down the comment) with the following ChangeLogs (I forgot to say that we require them too): 2020-03-11 Richard Wai <rich...@annexi-strayline.com> * gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on the Alias of the entitiy, if it is present, in the main assertion. 2020-03-11 Richard Wai <rich...@annexi-strayline.com> * gnat.dg/subpools1.adb: New test. [The next time please send the patch and the testcase as attachments instead, they apparently have been mangled by your mailer.] -- Eric Botcazou