Using r127057 I get an internal compiler error with the following testcase: ----------------------------------------------------------------- program test_gfortran2 implicit none Integer, Parameter :: & Double = Selected_Real_Kind(15,200) Integer :: j Complex(Double) :: g(5) Complex(Double) :: zh(38) Real(Double) :: g_q(5) do j=1,3 g(:) = conjg(-(zh(j)/cmplx(0.0_Double, -g_q(:), Double)))- & zh(j)/cmplx(0,-g_q(:)) end do end ----------------------------------------------------------------- gfortran -c test_gfortran2.f90 gives: ----------------------------------------------------------------- test_gfortran2.f90:15: internal compiler error: in emit_move_insn, at expr.c:3316 ----------------------------------------------------------------- gfortran 4.2.1 compiles fine. Platform is i686, trying this on a Debian lenny system.
Confirmed on PPC Darwin8, ICE on 4.3, pass on 4.2
Works with 2007-02-02-r121508 (on x86-64-linux) Fails with 2007-02-02-r121519 (on x86-64-linux) Ignoring Java and testsuite changes one finds the following changelog: gcc/ChangeLog: +2007-02-02 Ian Lance Taylor <iant@google.com> + * expmed.c (expand_divmod): Add comment. +2007-02-02 Kazu Hirata <kazu@codesourcery.com> + * emit-rtl.c (renumber_insns): Remove. + * flags.h: Remove the extern for flag_renumber_insns. + * rtl.h: Remove the prototype for renumber_insns. + * toplev.c (flag_renumber_insns): Remove. +2007-02-02 Hui-May Chang <hm.chang@apple.com> + Revert for x86 darwin: + 2005-06-19 Uros Bizjak <uros@kss-loka.si> + * config/i386/i386.c (ix86_function_arg_regno_p): Put back the + code before the following patch under TARGET_MACHO. + (ix86_function_value_regno_p): Likewise. +2007-02-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + * fold-const.c (negate_expr_p, fold_negate_expr): Handle + COMPLEX_EXPR. +2007-02-02 Maxim Kuvyrkov <mkuvyrkov@ispras.ru> + PR target/29682 + * config/ia64/ia64.c (ia64_speculate_insn): Restrict to memory loads to + general or fp registers. Add comments. + * config/ia64/ia64.md (reg_pred_prefix): Add comment.
Reduced testcase: program test_gfortran2 Complex(8) :: g, zh Real(8) :: g_q g = zh/cmplx(0.0_8, -g_q, 8) - zh/cmplx(0.0_8,-g_q) end This is, again, all about kinds. If all involved variables are of kind=4 or kind=8, it passes. Mixed kinds as above (cmplx(0.0_8,-g_q) returns a COMPLEX of kind=4) crash gfortran.
With stage1 based f95, I get a different ICE which shows the issue: t.f90:2: error: type mismatch in complex expression complex8 real8 real4 D.1336 = COMPLEX_EXPR <-0.0, D.1335> t.f90:5: confused by earlier errors, bailing out
Here is an even shorter testcase: program test_gfortran2 Complex(8) :: g, zh Real(8) :: g_q g = zh - zh/cmplx(0.0_8,-g_q) end
And here is a patch which fixes the ICE: Index: fold-const.c =================================================================== --- fold-const.c (revision 127042) +++ fold-const.c (working copy) @@ -1382,7 +1382,7 @@ { tem = strip_float_extensions (t); if (tem != t && negate_expr_p (tem)) - return negate_expr (tem); + return fold_convert (type, negate_expr (tem)); } break;
> And here is a patch which fixes the ICE: Confirmed and regtested on PPC Darwin.
Mine.
Subject: Bug 32935 Author: pinskia Date: Fri Aug 3 23:36:05 2007 New Revision: 127190 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127190 Log: 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32935 * fold-convert.c (fold_negate_expr <NOP_EXPR>): Convert back to the correct type the negate expression. 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32935 * gfortran.fortran-torture/compile/complex_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.fortran-torture/compile/complex_1.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Fixed.