r274355 - in /trunk/gcc: ada/ChangeLog ada/exp_...
pmderodat@gcc.gnu.org
pmderodat@gcc.gnu.org
Tue Aug 13 08:08:00 GMT 2019
Author: pmderodat
Date: Tue Aug 13 08:08:22 2019
New Revision: 274355
URL: https://gcc.gnu.org/viewcvs?rev=274355&root=gcc&view=rev
Log:
[Ada] Do not remove side-effects in an others_clause with function calls
An aggregate can be handled by the backend if it consists of static
constants of an elementary type, or null. If a component is a type
conversion we must preanalyze and resolve it to determine whether the
ultimate value is in one of these categories. Previously we did a full
analysis and resolution of the expression for the component, which could
lead to a removal of side-effects, which is semantically incorrect if
the expression includes functions with side-effects (e.g. a call to a
random generator).
2019-08-13 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Preanalyze
expression, rather do a full analysis, to prevent unwanted
removal of side effects which mask the intent of the expression.
gcc/testsuite/
* gnat.dg/aggr27.adb: New testcase.
Added:
trunk/gcc/testsuite/gnat.dg/aggr27.adb
Modified:
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/exp_aggr.adb
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-cvs
mailing list