summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authordfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-09 21:36:33 +0000
committerdfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-09 21:36:33 +0000
commit0d290c9d17fe55e9c70da316068fd3fb2d0ab72d (patch)
treed0261b1558010b2bff855fc04710cf96134d1417 /gcc
parenta1a2dd690b8b894db8e4363a8efd49043bf2e35f (diff)
downloadgcc-0d290c9d17fe55e9c70da316068fd3fb2d0ab72d.tar.gz
gcc/fortran/:
2010-06-09 Daniel Franke <franke.daniel@gmail.com> PR fortran/44347 * check.c (gfc_check_selected_real_kind): Verify that the actual arguments are scalar. gcc/testsuite/: 2010-06-09 Daniel Franke <franke.daniel@gmail.com> PR fortran/44347 * gfortran.dg/selected_real_kind_1.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160506 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/check.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/selected_real_kind_1.f9010
4 files changed, 37 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index cafbd314b2e..c67dd8f5879 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+ PR fortran/44347
+ * check.c (gfc_check_selected_real_kind): Verify that the
+ actual arguments are scalar.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
PR fortran/44359
* intrinsic.c (gfc_convert_type_warn): Further improve -Wconversion.
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 6a5c263ed50..81f3e24847b 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -2930,11 +2930,23 @@ gfc_check_selected_real_kind (gfc_expr *p, gfc_expr *r)
return FAILURE;
}
- if (p != NULL && type_check (p, 0, BT_INTEGER) == FAILURE)
- return FAILURE;
+ if (p)
+ {
+ if (type_check (p, 0, BT_INTEGER) == FAILURE)
+ return FAILURE;
- if (r != NULL && type_check (r, 1, BT_INTEGER) == FAILURE)
- return FAILURE;
+ if (scalar_check (p, 0) == FAILURE)
+ return FAILURE;
+ }
+
+ if (r)
+ {
+ if (type_check (r, 1, BT_INTEGER) == FAILURE)
+ return FAILURE;
+
+ if (scalar_check (r, 1) == FAILURE)
+ return FAILURE;
+ }
return SUCCESS;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5dcee0fb166..d0154a9fe27 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+ PR fortran/44347
+ * gfortran.dg/selected_real_kind_1.f90: New.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
PR fortran/44359
* gfortran.dg/warn_conversion.f90: Removed check for redundant
warning.
diff --git a/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90 b/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90
new file mode 100644
index 00000000000..0f40a595d2f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90
@@ -0,0 +1,10 @@
+! { dg-do "compile" }
+!
+! PR fortran/44347 - arguments of SELECTED_REAL_KIND shall be scalar
+! Testcase contributed by Vittorio Zecca <zeccav AT gmail DOT com>
+!
+
+ dimension ip(1), ir(1)
+ i = selected_real_kind(ip, i) ! { dg-error "must be a scalar" }
+ j = selected_real_kind(i, ir) ! { dg-error "must be a scalar" }
+end