public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ICE in attempt_builtin_copysign
@ 2015-10-15 13:20 Marek Polacek
  0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2015-10-15 13:20 UTC (permalink / raw)
  To: GCC Patches

Richi pointed out that SPEC 2006 447.dealII ICEs with a SIGSEGV
because of my recent changes in reassoc.  This patch fixes it.

Bootstrapped/regtested on x86_64-linux, applying to trunk.

2015-10-15  Marek Polacek  <polacek@redhat.com>

	* tree-ssa-reassoc.c (attempt_builtin_copysign): Call
	gimple_call_builtin instead of is_gimple_call.

	* gcc.dg/tree-ssa/reassoc-42.c: New test.

diff --git gcc/testsuite/gcc.dg/tree-ssa/reassoc-42.c gcc/testsuite/gcc.dg/tree-ssa/reassoc-42.c
index e69de29..9c8eb39 100644
--- gcc/testsuite/gcc.dg/tree-ssa/reassoc-42.c
+++ gcc/testsuite/gcc.dg/tree-ssa/reassoc-42.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+double
+foo (double f(void))
+{
+  return 2. * f ();
+}
diff --git gcc/tree-ssa-reassoc.c gcc/tree-ssa-reassoc.c
index 62438dd..86cf3e8 100644
--- gcc/tree-ssa-reassoc.c
+++ gcc/tree-ssa-reassoc.c
@@ -4643,7 +4643,7 @@ attempt_builtin_copysign (vec<operand_entry *> *ops)
 	  && has_single_use (oe->op))
 	{
 	  gimple *def_stmt = SSA_NAME_DEF_STMT (oe->op);
-	  if (is_gimple_call (def_stmt))
+	  if (gimple_call_builtin_p (def_stmt, BUILT_IN_NORMAL))
 	    {
 	      tree fndecl = gimple_call_fndecl (def_stmt);
 	      tree arg0, arg1;

	Marek

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-15 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 13:20 [PATCH] Fix ICE in attempt_builtin_copysign Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).