Fix PR87929

Message ID alpine.LSU.2.20.1811081146340.1827@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR87929
Related show

Commit Message

Richard Biener Nov. 8, 2018, 10:47 a.m.
Bootstrapped & tested on x86_64-unknown-linux-gnu, applied.

Richard.

From f3d02105b799975047a51ad80488f9cd928419bf Mon Sep 17 00:00:00 2001
From: Richard Guenther <rguenther@suse.de>
Date: Thu, 8 Nov 2018 10:22:09 +0100
Subject: [PATCH] fix-pr87929

2018-11-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87929
	* tree-complex.c (expand_complex_comparison): Clean EH.

	* gcc.dg/pr87929.c: New testcase.

Patch

diff --git a/gcc/testsuite/gcc.dg/pr87929.c b/gcc/testsuite/gcc.dg/pr87929.c
new file mode 100644
index 00000000000..f64f7ada442
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr87929.c
@@ -0,0 +1,16 @@ 
+/* { dg-do compile } */
+/* { dg-options "-fexceptions -fnon-call-exceptions -fsignaling-nans" } */
+
+#define complex __complex__
+#define _Complex_I (1.0iF)
+
+extern void f2c_4d__( complex float *, complex float *);
+extern void abort (void);
+
+void f2c_4c__(void)
+{
+  complex float x,ret_val;
+  x = 1234 + 5678 * _Complex_I;
+  f2c_4d__(&ret_val,&x);
+  if ( x != ret_val ) abort();
+}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 49088081bb0..4bf644f9473 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1558,6 +1558,8 @@  expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
     }
 
   update_stmt (stmt);
+  if (maybe_clean_eh_stmt (stmt))
+    gimple_purge_dead_eh_edges (gimple_bb (stmt));
 }
 
 /* Expand inline asm that sets some complex SSA_NAMEs.  */