This change ensures that the NULL statement generated for coverage analysis
purposes in an otherwise empty ACCEPT alternative is not eliminated by GIGI
or the code generator by setting its Comes_From_Source flag.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-23  Thomas Quinot  <qui...@adacore.com>

        * exp_ch9.adb (Ensure_Statement_Present): Mark generated NULL
        statement as Comes_From_Source so that GIGI does not eliminate it.

Index: exp_ch9.adb
===================================================================
--- exp_ch9.adb (revision 189768)
+++ exp_ch9.adb (working copy)
@@ -5484,11 +5484,19 @@
    ------------------------------
 
    procedure Ensure_Statement_Present (Loc : Source_Ptr; Alt : Node_Id) is
+      Stmt : Node_Id;
    begin
       if Opt.Suppress_Control_Flow_Optimizations
         and then Is_Empty_List (Statements (Alt))
       then
-         Set_Statements (Alt, New_List (Make_Null_Statement (Loc)));
+         Stmt := Make_Null_Statement (Loc);
+
+         --  Mark NULL statement as coming from source so that it is not
+         --  eliminated by GIGI.
+
+         Set_Comes_From_Source (Stmt, True);
+
+         Set_Statements (Alt, New_List (Stmt));
       end if;
    end Ensure_Statement_Present;
 

Reply via email to