[patch] Fix PR middle-end/56474

Eric Botcazou ebotcazou@adacore.com
Sun Apr 14 14:14:00 GMT 2013


Hi,

this is a regression present on the mainline and 4.8 branch and introduced by 
the latest series of sizetype changes.  Associated adjustments were made in 
the various front-ends for it, most notably Ada which was the most affected, 
but this issue slipped through the cracks in the form of a bogus overflow 
detection for 0-based arrays with variable upper bound included in a record 
with discriminant.

The proposed fix is to disable overflow detection in sizetype for one special 
case (0 - 1) in size_binop_loc.  An equivalent kludge was added to layout_type 
to disable overflow detection for the size expression of [0, -1] arrays.

Tested on x86_64-suse-linux, OK for the mainline and 4.8 branch?


2013-04-14  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/56474
	* fold-const.c (size_binop_loc): Disable overflow detection for 0 - 1.


2013-04-14  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/array3.ads: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130414/5e0c7a37/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array3.ads
Type: text/x-adasrc
Size: 367 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130414/5e0c7a37/attachment-0001.bin>


More information about the Gcc-patches mailing list