[Ada] Crash on conversion in branch of if-expression
commit90393d3ca7fe7547777473f4b197792f1cb3fca9
authorEd Schonberg <schonberg@adacore.com>
Mon, 16 Dec 2019 10:33:54 +0000 (16 10:33 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 16 Dec 2019 10:33:54 +0000 (16 10:33 +0000)
tree821a6b8acb86adc767c5f4b93f61910f7b03211f
parent4a1872632c20e4b93d5d3214505470966c0bebb4
[Ada] Crash on conversion in branch of if-expression

2019-12-16  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* checks.adb (Apply_Float_Conversion_Check): Use node of type
conversion and not its parent, when inserting the declaration
for the temporary that hold the result of the conversion.
Previously the declaration was inserted above the parent of the
conversion, apparently as a small optimization for the
subsequent traversal in Insert_Actions.  Unfortunately a similar
optimization takes place in Insert_Actions, assuming that the
insertion point must be above the expression that creates the
actions to insert.  This is not correct in the presence of
conditional expressions (i.e.  since Ada2012), where the
insertion must be in the list of actions attached to the current
alternative.

From-SVN: r279422
gcc/ada/ChangeLog
gcc/ada/checks.adb