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]

Add testcase for PR ada/43106


Tested on i586-suse-linux, installed on the mainline.


2010-03-19  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/43106
	* gnat.dg/case_optimization2.adb: New test.
	* gnat.dg/case_optimization_pkg2.ad[sb]: New helper.

	
-- 
Eric Botcazou
-- PR ada/43106
-- Testcase by Bill Neven <neven@hitt.nl>

-- { dg-do run }
-- { dg-options "-O" }

with Case_Optimization_Pkg2; use Case_Optimization_Pkg2;

procedure Case_Optimization2 is
   Radar : Radar_T;
begin
   Radar.Sensor_Type := radcmb;
   Initialize (Radar);
end;
package body Case_Optimization_Pkg2 is

  procedure Initialize (Radar : in Radar_T) is
    Antenna1 : Antenna_Type_T;
    Antenna2 : Antenna_Type_T;
  begin
    case Radar.Sensor_Type is
      when radpr | radssr =>
        Antenna1 := Radar.Sensor_Type;
        Antenna2 := Radar.Sensor_Type;
      when radcmb =>
        Antenna1 := radpr;
        Antenna2 := radssr;
      when others =>
        Antenna1 := radpr;
        Antenna2 := radssr;
    end case;
    if Antenna1 /= radpr or Antenna2 /= radssr then
      raise Program_Error;
    end if;
  end Initialize;

end Case_Optimization_Pkg2;
package Case_Optimization_Pkg2 is

   type Unsigned_64 is mod 2 ** 64;

   type Associated_Report_T is (miss, radpr, radssr, radcmb);

   -- sensor type : primary, secondary, co-rotating (combined)
   subtype Sensor_Type_T is Associated_Report_T; -- range radpr .. radcmb;
   subtype Antenna_Type_T is Sensor_Type_T range radpr .. radssr;

   type Filtering_Level_T is (none, pr_in_clutter, ssr_plots, pr_plots);
   type Filtering_Levels_T is array (Filtering_Level_T) of boolean;

   type Radar_T is record
      External_Sensor_ID : Unsigned_64;
      Dual_Radar_Index : Integer;
      Compatible_Filtering_Levels : Filtering_Levels_T;
      Sensor_Type : Sensor_Type_T;
   end record;

   procedure Initialize (Radar : in Radar_T);

end Case_Optimization_Pkg2;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]