r274348 - in /trunk/gcc: ada/ChangeLog ada/exp_...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Tue Aug 13 08:07:00 GMT 2019


Author: pmderodat
Date: Tue Aug 13 08:07:46 2019
New Revision: 274348

URL: https://gcc.gnu.org/viewcvs?rev=274348&root=gcc&view=rev
Log:
[Ada] Compiler may blow up on array aggregates whose size is very large

The compiler may crash when compiling array aggregates where the
computation of the size produces a very large number that overflows
(possibly producing a small result), such as with an aggregate of a type
that is an array of arrays, where each array range has close to
Integer'Last elements. That can lead to Aggr_Size_OK returning
incorrectly returning True, following on to allocating a very large
array in function Flatten that blows the stack.  The size computation
was being performed using type Int, so this was changed to use universal
arithmetic.

2019-08-13  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

	* exp_aggr.adb (Aggr_Size_OK): Compute the aggregate size using
	universal arithmetic, to avoid situations where the size
	computation overflows.

gcc/testsuite/

	* gnat.dg/aggr26.adb: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/aggr26.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/exp_aggr.adb
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list