[Ada] Avoid crash in GNATprove_Mode on allocator inside type
Pierre-Marie de Rodat
derodat@adacore.com
Tue Aug 13 08:32:00 GMT 2019
In the special mode for GNATprove, subtypes should be declared for
allocators when constraints are used. This was done previously but it
does not work inside spec expressions, as the declaration is not
inserted and analyzed in the AST in that case, leading to a later crash
on an incomplete entity. Thus, no declaration should be created in such
a case, letting GNATprove later reject such code due to the use of an
allocator in an interfering context.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-08-13 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_ch4.adb (Analyze_Allocator): Do not insert subtype
declaration for allocator inside a spec expression.
gcc/testsuite/
* gnat.dg/allocator2.adb, gnat.dg/allocator2.ads: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1782 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190813/23be8c38/attachment.bin>
More information about the Gcc-patches
mailing list