[Ada] Length of empty array with bounds overflowing result type

Eric Botcazou ebotcazou@adacore.com
Fri Nov 7 10:36:00 GMT 2008


This patch removes an unwanted early conversion of range bounds to the
result type when testing whether a range is empty.  The extra conversion
may overflow and cause the check for empty range to return an incorrect
result, like in the attached testcase.

Tested on i586-suse-linux, applied on the mainline.


2008-11-07  Thomas Quinot  <quinot@adacore.com>

	* gcc-interface/trans.c (Attribute_to_gnu, case Attr_Length): Check
	for empty range in original base type, not converted result type.


2008-11-07  Thomas Quinot  <quinot@adacore.com>

	* gnat.dg/hyper_flat.adb: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 1220 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081107/9b78e8d8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hyper_flat.adb
Type: text/x-adasrc
Size: 312 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081107/9b78e8d8/attachment-0001.bin>


More information about the Gcc-patches mailing list