summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/aliasing2.adb
blob: abfc6e11a3ff994907f8befee600d6bb65d2bdff (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-final_cleanup" }

-- The raise statement must be optimized away by
-- virtue of TYPE_NONALIASED_COMPONENT set on A.

package body Aliasing2 is

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

end Aliasing2;

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