public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] FIx PR midde-end/32935 ICE in emit_move_insn due to fold producing type mismatch with negative and fp
@ 2007-08-03 14:45 Andrew Pinski
  2007-08-03 19:49 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2007-08-03 14:45 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

Hi,
  The problem here is that fold strips off the floating point
extensions but then does not convert the negative expression back to
the original type which causes a type mismatch.  This causes either an
ICE with the extra checking Richard Guenther added or an ICE in
emit_move_insn.  This patch here adds a fold_convert to convert to the
correct type after the negate expression.

OK?  Bootstrapped and tested on i686-apple-darwin8.10 with no regressions.

Thanks,
Andrew Pinski

* fold-convert.c (fold_negate_expr <NOP_EXPR>): Convert back to the correct
type the negate expression.

* gfortran.fortran-torture/compile/complex_1.f90: New test

[-- Attachment #2: fixpr32935.diff.txt --]
[-- Type: text/plain, Size: 792 bytes --]

Index: fold-const.c
===================================================================
--- fold-const.c	(revision 127176)
+++ fold-const.c	(working copy)
@@ -1382,7 +1382,7 @@ fold_negate_expr (tree t)
 	{
 	  tem = strip_float_extensions (t);
 	  if (tem != t && negate_expr_p (tem))
-	    return negate_expr (tem);
+	    return fold_convert (type, negate_expr (tem));
 	}
       break;
 
Index: testsuite/gfortran.fortran-torture/compile/complex_1.f90
===================================================================
--- testsuite/gfortran.fortran-torture/compile/complex_1.f90	(revision 0)
+++ testsuite/gfortran.fortran-torture/compile/complex_1.f90	(revision 0)
@@ -0,0 +1,5 @@
+program test_gfortran2
+ Complex(8) :: g, zh
+ Real(8)    :: g_q
+ g =   zh - zh/cmplx(0.0_8,-g_q)
+end

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-03 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 14:45 [PATCH] FIx PR midde-end/32935 ICE in emit_move_insn due to fold producing type mismatch with negative and fp Andrew Pinski
2007-08-03 19:49 ` Diego Novillo

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).