aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-05-12 21:35:37 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-05-12 21:35:37 +0000
commit4265801ba08846319f84c3648f825fb76085f595 (patch)
tree1e2f7f7fa85efcdd3543f687f7985306339dea16 /gcc
parent4ce5754013932cc0072b0393e254c4b9bca317ce (diff)
downloadgcc-4265801ba08846319f84c3648f825fb76085f595.zip
gcc-4265801ba08846319f84c3648f825fb76085f595.tar.gz
gcc-4265801ba08846319f84c3648f825fb76085f595.tar.bz2
function.c (requires_stack_frame_p): If the function can throw non-call exceptions...
* function.c (requires_stack_frame_p): If the function can throw non-call exceptions, return true if the insn can throw internally. From-SVN: r187429
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref3.adb24
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 57c9ec1..355ae3a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * 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 <paolo.carlini@oracle.com>
* doc/generic.texi: Rename TYPE_PTRMEM_P to TYPE_PTRDATAMEM_P.
diff --git a/gcc/function.c b/gcc/function.c
index b5e9011..00c55a1 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 5f5e689..2869ef2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/null_pointer_deref3.adb: New test.
+
2012-05-12 Tobias Burnus <burnus@net-b.de>
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 0000000..f92242e
--- /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;