aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-07-28 17:48:54 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-07-28 17:48:54 +0000
commit1b70aaad4c090c90d69c514138a8c157af930b57 (patch)
tree495433b2b5b20e6c292bc4b9a9e31ba6559041cc /gcc
parent717a7673782bff840ea538efd9fb1e2e8d2b816a (diff)
downloadgcc-1b70aaad4c090c90d69c514138a8c157af930b57.zip
gcc-1b70aaad4c090c90d69c514138a8c157af930b57.tar.gz
gcc-1b70aaad4c090c90d69c514138a8c157af930b57.tar.bz2
re PR fortran/71859 (ICE on same variable/subroutine name (verify_gimple failed))
2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/71859 * check.c(numeric_check): Prevent ICE. Issue error for invalid subroutine as an actual argument when numeric argument is expected. 2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/71859 * gfortran.dg/pr71859.f90: New test. * gfortran.dg/intrinsic_numeric_arg.f: Update error message. * gfortran.dg/coarray_collectives_1.f90: Ditto. From-SVN: r238825
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/check.c9
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_collectives_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_numeric_arg.f4
-rw-r--r--gcc/testsuite/gfortran.dg/pr71859.f908
6 files changed, 32 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 85f2107..a5c2968 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,10 @@
2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/71859
+ * check.c(numeric_check): Prevent ICE. Issue error for invalid
+ subroutine as an actual argument when numeric argument is expected.
+
+2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71883
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 7fc60808..085ac40 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -72,6 +72,11 @@ type_check (gfc_expr *e, int n, bt type)
static bool
numeric_check (gfc_expr *e, int n)
{
+ /* Users sometime use a subroutine designator as an actual argument to
+ an intrinsic subprogram that expects an argument with a numeric type. */
+ if (e->symtree && e->symtree->n.sym->attr.subroutine)
+ goto error;
+
if (gfc_numeric_ts (&e->ts))
return true;
@@ -86,7 +91,9 @@ numeric_check (gfc_expr *e, int n)
return true;
}
- gfc_error ("%qs argument of %qs intrinsic at %L must be a numeric type",
+error:
+
+ gfc_error ("%qs argument of %qs intrinsic at %L must have a numeric type",
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2a15ab0..c9746c6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/71859
+ * gfortran.dg/pr71859.f90: New test.
+ * gfortran.dg/intrinsic_numeric_arg.f: Update error message.
+ * gfortran.dg/coarray_collectives_1.f90: Ditto.
+
2016-07-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/71883
diff --git a/gcc/testsuite/gfortran.dg/coarray_collectives_1.f90 b/gcc/testsuite/gfortran.dg/coarray_collectives_1.f90
index a09a81f..cdb3993 100644
--- a/gcc/testsuite/gfortran.dg/coarray_collectives_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_collectives_1.f90
@@ -14,7 +14,7 @@ program test
integer(8) :: i8
character(len=19, kind=4) :: msg4
- call co_sum("abc") ! { dg-error "must be a numeric type" }
+ call co_sum("abc") ! { dg-error "must have a numeric type" }
call co_max(cmplx(1.0,0.0)) ! { dg-error "shall be of type integer, real or character" }
call co_min(cmplx(0.0,1.0)) ! { dg-error "shall be of type integer, real or character" }
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_numeric_arg.f b/gcc/testsuite/gfortran.dg/intrinsic_numeric_arg.f
index 3257d45..445c39e 100644
--- a/gcc/testsuite/gfortran.dg/intrinsic_numeric_arg.f
+++ b/gcc/testsuite/gfortran.dg/intrinsic_numeric_arg.f
@@ -4,6 +4,6 @@
LOGICAL Z
CHARACTER A
REAL R
- R = ABS(Z) ! { dg-error " must be a numeric type" }
- R = ABS(A) ! { dg-error " must be a numeric type" }
+ R = ABS(Z) ! { dg-error " must have a numeric type" }
+ R = ABS(A) ! { dg-error " must have a numeric type" }
END
diff --git a/gcc/testsuite/gfortran.dg/pr71859.f90 b/gcc/testsuite/gfortran.dg/pr71859.f90
new file mode 100644
index 0000000..0dc6177
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr71859.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+program p
+ call s(1)
+ x = abs(s) ! { dg-error "must have a numeric type" }
+end
+subroutine s(n)
+ print *, n
+end