[Ada] Fix handling of slices with subtype names

Pierre-Marie de Rodat derodat@adacore.com
Mon Oct 4 08:47:52 GMT 2021


When resolving a slice with subtype name we created a shallow copy of
the type range and applied range checks to this copy. This was wrong,
because when applying checks we were modifying the type declaration
itself (and the type could be anything, for example the predefined
Integer type).

Instead of a shallow copy, we now create a subtype'range attribute,
analyze it and apply checks, but insert those checks into the slice
range expression node.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_res.adb (Resolve_Slice): Fix application of range checks
	to slice range given as a subtype name.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1665 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211004/a9feb951/attachment.bin>


More information about the Gcc-patches mailing list