From: ebotcazou Date: Sat, 12 May 2012 21:35:37 +0000 (+0000) Subject: * function.c (requires_stack_frame_p): If the function can throw X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec3aa8fee567d7b8ba1bb08691630f6e3fc2e534;p=thirdparty%2Fgcc.git * function.c (requires_stack_frame_p): If the function can throw non-call exceptions, return true if the insn can throw internally. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187429 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 57c9ec10a004..355ae3a049e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-05-12 Eric Botcazou + + * function.c (requires_stack_frame_p): If the function can throw + non-call exceptions, return true if the insn can throw internally. + 2012-05-12 Paolo Carlini * doc/generic.texi: Rename TYPE_PTRMEM_P to TYPE_PTRDATAMEM_P. diff --git a/gcc/function.c b/gcc/function.c index b5e9011ce23d..00c55a16a62a 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5316,6 +5316,10 @@ requires_stack_frame_p (rtx insn, HARD_REG_SET prologue_used, if (CALL_P (insn)) return !SIBLING_CALL_P (insn); + /* We need a frame to get the unique CFA expected by the unwinder. */ + if (cfun->can_throw_non_call_exceptions && can_throw_internal (insn)) + return true; + CLEAR_HARD_REG_SET (hardregs); for (df_rec = DF_INSN_DEFS (insn); *df_rec; df_rec++) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f5e68922729..2869ef23e1f5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-05-12 Eric Botcazou + + * gnat.dg/null_pointer_deref3.adb: New test. + 2012-05-12 Tobias Burnus PR fortran/49110 diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref3.adb b/gcc/testsuite/gnat.dg/null_pointer_deref3.adb new file mode 100644 index 000000000000..f92242e7e679 --- /dev/null +++ b/gcc/testsuite/gnat.dg/null_pointer_deref3.adb @@ -0,0 +1,24 @@ +-- { dg-do run } +-- { dg-options "-O -gnatp" } + +-- This test requires architecture- and OS-specific support code for unwinding +-- through signal frames (typically located in *-unwind.h) to pass. Feel free +-- to disable it if this code hasn't been implemented yet. + +procedure Null_Pointer_Deref3 is + + procedure Leaf is + type Int_Ptr is access all Integer; + function n return Int_Ptr is + begin return null; end; + + Data : Int_Ptr := n; + begin + Data.all := 0; + end; + +begin + Leaf; +exception + when others => null; +end;