summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/aliasing1.adb
blob: b2b7d123b1fbcc1e1e0a85b0dd7a41d7917b1ba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -fdump-tree-optimized" }

-- The raise statement must be optimized away by
-- virtue of DECL_NONADDRESSABLE_P set on R.I.

package body Aliasing1 is

  function F (P : Ptr) return Integer is
  begin
    R.I := 0;
    P.all := 1;
    if R.I /= 0 then
      raise Program_Error;
    end if;
    return 0;
  end;

end Aliasing1;

-- { dg-final { scan-tree-dump-not "__gnat_rcheck" "optimized" } }
-- { dg-final { cleanup-tree-dump "optimized" } }