From e1332188a4c377db70d82b8e6a5df3961b1a4499 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Tue, 30 Oct 2007 21:48:23 +0000 Subject: [PATCH] re PR fortran/33596 (ICE with simplified ISNAN) PR fortran/33596 * trans-intrinsic.c (gfc_conv_intrinsic_isnan): Strip NOP_EXPR from the result of build_call_expr. * gfortran.dg/isnan_2.f90: New test. From-SVN: r129782 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-intrinsic.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/isnan_2.f90 | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/isnan_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a761a953569..c7c99bf4532 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-10-30 Francois-Xavier Coudert + + PR fortran/33596 + * trans-intrinsic.c (gfc_conv_intrinsic_isnan): Strip NOP_EXPR + from the result of build_call_expr. + 2007-10-29 Paul Thomas PR fortran/31217 diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 7cc0c6fe10f..24f24429311 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2757,6 +2757,7 @@ gfc_conv_intrinsic_isnan (gfc_se * se, gfc_expr * expr) gfc_conv_intrinsic_function_args (se, expr, &arg, 1); se->expr = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, arg); + STRIP_TYPE_NOPS (se->expr); se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e52b0b88dc..5a266cee36f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-10-30 Francois-Xavier Coudert + + PR fortran/33596 + * gfortran.dg/isnan_2.f90: New test. + 2007-10-30 Ed Schouten PR tree-optimization/32500 diff --git a/gcc/testsuite/gfortran.dg/isnan_2.f90 b/gcc/testsuite/gfortran.dg/isnan_2.f90 new file mode 100644 index 00000000000..e16ce9de101 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/isnan_2.f90 @@ -0,0 +1,17 @@ +! Test for the ISNAN intrinsic on constants +! +! { dg-do run } +! { dg-options "-fno-range-check" } +! { dg-options "-fno-range-check -pedantic-errors -mieee" { target sh*-*-* } } +! + implicit none + character(len=1) :: s + write(s,'(L1)') isnan(0.) + if (s /= 'F') call abort + + write(s,'(L1)') isnan(exp(huge(0.))) + if (s /= 'F') call abort + + write(s,'(L1)') isnan(0./0.) + if (s /= 'T') call abort +end -- 2.30.2