]> gcc.gnu.org Git - gcc.git/commit
[Ada] Prevent overflow in computation of aggregate size
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 31 Mar 2022 18:56:58 +0000 (20:56 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 18 May 2022 08:41:01 +0000 (08:41 +0000)
commit16b8ba101f770503f363c095d7be5c055705b84b
tree95075cab4bf70f4cef9e7f06883460d63134bcc3
parent8b49556e4ee617e0920a9335685c7961971c3d0a
[Ada] Prevent overflow in computation of aggregate size

When computing size of a static aggregate to decide if it should be
transformed into assignments and loops we could have an overflow check.
This is mostly harmless, because colossal aggregates will likely crash
the application anyway, no matter how we transform them.

This was not detected because compiler was built with -gnatg switch that
suppresses overflow checks (they are only enabled by an explicit -gnato
switch).

gcc/ada/

* exp_aggr.adb (Component_Count): Calculate size as an Uint and
only then check if it is in the range of Int, as otherwise the
multiplication of Int values can overflow.
gcc/ada/exp_aggr.adb
This page took 0.062625 seconds and 6 git commands to generate.