re PR fortran/33596 (ICE with simplified ISNAN)
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tue, 30 Oct 2007 21:48:23 +0000 (21:48 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tue, 30 Oct 2007 21:48:23 +0000 (21:48 +0000)
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
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/isnan_2.f90 [new file with mode: 0644]

index a761a9535699e2f9914e9569eac47aafb702aae2..c7c99bf4532963b07a9240a98f93d72b5fe30ae2 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-30  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       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  <pault@gcc.gnu.org>
 
        PR fortran/31217
index 7cc0c6fe10fb01882d1571209487446802137025..24f24429311d2feaf3803be36260f0d05b6789c5 100644 (file)
@@ -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);
 }
 
index 4e52b0b88dc1ba870b4dfd77d48d237f563f240c..5a266cee36f3acd3529e8282ad08751de1a6600f 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-30  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33596
+       * gfortran.dg/isnan_2.f90: New test.
+
 2007-10-30  Ed Schouten  <ed@fxq.nl>
 
        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 (file)
index 0000000..e16ce9d
--- /dev/null
@@ -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