summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt60.adb
blob: 9154fb46fa651f3b872d5b28a0d726e66a32b71c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- { dg-do compile }
-- { dg-options "-gnatws -O2 -fdump-tree-optimized" }

with System; use System;
with System.CRTL; use System.CRTL;

function Opt60 (Size : size_t) return System.Address is
  Result : System.Address;
begin
  Result := malloc (Size);
  if Result = System.Null_Address then
    raise Program_Error;
  end if;
  return Result;
end;

-- { dg-final { scan-tree-dump "== 0B" "optimized" } }