]> gcc.gnu.org Git - gcc.git/commit
sem_prag.adb (No_Return): Give an error if the pragma applies to a body.
authorBob Duff <duff@adacore.com>
Tue, 25 Apr 2017 10:39:02 +0000 (10:39 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 25 Apr 2017 10:39:02 +0000 (12:39 +0200)
commitca1f6b2991e1864c8db5c9f082c62804467b2a07
tree92f49dea30cdd60ad3a79c1d0e99556ae64c1cb4
parent36357cf398c9837313d3d62dbdc1e7b883f47135
sem_prag.adb (No_Return): Give an error if the pragma applies to a body.

2017-04-25  Bob Duff  <duff@adacore.com>

* sem_prag.adb (No_Return): Give an error if the pragma applies
to a body. Specialize the error for the specless body case,
as is done for (e.g.) pragma Convention.
* debug.adb: Add switch -gnatd.J to disable the above legality
checks. This is mainly for use in our test suite, to avoid
rewriting a lot of illegal (but working) code. It might also
be useful to customers. Under this switch, if a pragma No_Return
applies to a body, and the procedure raises an exception (as it
should), the pragma has no effect. If the procedure does return,
execution is erroneous.

2017-04-25  Bob Duff  <duff@adacore.com>

* exp_ch6.adb (Expand_Actuals): This is the
root of the problem. It took N as an 'in out' parameter, and in
some cases, rewrote N, but then set N to Original_Node(N). So
the node returned in N had no Parent. The caller continued
processing of this orphaned node. In some cases that caused a
crash (e.g. Remove_Side_Effects climbs up Parents in a loop,
and trips over the Empty Parent). The solution is to make N an
'in' parameter.  Instead of rewriting it, return the list of
post-call actions, so the caller can do the rewriting later,
after N has been fully processed.
(Expand_Call_Helper): Move most of Expand_Call here. It has
too many premature 'return' statements, and we want to do the
rewriting on return.
(Insert_Post_Call_Actions): New procedure to insert the post-call
actions in the appropriate place. In the problematic case,
that involves rewriting N as an Expression_With_Actions.
(Expand_Call): Call the new procedures Expand_Call_Helper and
Insert_Post_Call_Actions.

From-SVN: r247178
gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/exp_ch6.adb
gcc/ada/sem_prag.adb
This page took 0.054077 seconds and 5 git commands to generate.