This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
This patch is the front end work for implementing a new node type
Expression_With_Actions. This is currently used if the debug flag
-gnatd.X is set and a short circuit form has right hand operand
actions. The sprint syntax is do action; action ... in expression end.
This test program:
procedure ExprActions (A, B, C : Natural; M, N : String) is
begin
if (A = 23 and then M (1 .. A) = N (1 .. B))
or else M (A .. B) = M (B .. C)
then
null;
end if;
end ExprActions;
Now generates the following -gnatG output if -gnatd.X is set:
Source recreated from tree for Expractions (body)
procedure expractions (a : natural; b : natural; c : natural; m :
string; n : string) is
subtype expractions__S2b is string (n'first(1) .. n'last(1));
subtype expractions__S1b is string (m'first(1) .. m'last(1));
begin
if (a = 23 and then
do
[constraint_error when
a >= 1 and then (1 < m'first(1) or else integer(a) > m'last(
1))
"range check failed"]
reference expractions__T4b[constraint_error when
b >= 1 and then (1 < n'first(1) or else integer(b) > n'last(
1))
"range check failed"]
reference expractions__T6b
in m (1 .. a) = n (1 .. b) end
) or else
do
[constraint_error when
b >= a and then (integer(a) < m'first(1) or else integer(b) >
m'last(1))
"range check failed"]
reference expractions__T8b[constraint_error when
c >= b and then (integer(b) < m'first(1) or else integer(c) >
m'last(1))
"range check failed"]
reference expractions__T10b
in m (a .. b) = m (b .. c) end
then
null;
end if;
return;
end expractions;
This patch does not include the required gigi adjustments to process
this new node (which is why it is under a debug flag for now), so with
only this patch, the above test compiled with -gnatd.X will blowup
in gigi. Eric will commit the corresponding support for
N_Expression_With_Actions in gigi later.
The motivation behind this is to avoid the problem with the old style
expansion of short circuit forms with right operand actions. The old
style introduced a boolean temporary which caused problems with
coverage analysis.
Tested on x86_64-pc-linux-gnu, committed on trunk
2010-06-17 Robert Dewar <dewar@adacore.com>
* debug.adb: New debug flag -gnatd.X to use Expression_With_Actions
node when expanding short circuit form with actions present for right
opnd.
* exp_ch4.adb: Minor reformatting
(Expand_Short_Circuit_Operator): Use new Expression_With_Actions node if
right opeand has actions present, and debug flag -gnatd.X is set.
* exp_util.adb (Insert_Actions): Handle case of Expression_With_Actions
node.
* nlists.adb (Prepend_List): New procedure
(Prepend_List_To): New procedure
* nlists.ads (Prepend_List): New procedure
(Prepend_List_To): New procedure
* sem.adb: Add processing for Expression_With_Actions
* sem_ch4.adb (Analyze_Expression_With_Actions): New procedure
* sem_ch4.ads (Analyze_Expression_With_Actions): New procedure
* sem_res.adb: Add processing for Expression_With_Actions.
* sem_scil.adb: Add processing for Expression_With_Actions
* sinfo.ads, sinfo.adb (N_Expression_With_Actions): New node.
* sprint.ads, sprint.adb: Add processing for Expression_With_Actions
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |