aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-05-28 22:28:08 +0200
committerHarald Anlauf <anlauf@gmx.de>2020-05-28 22:32:59 +0200
commit5c715e6a2990cfb6c15acc1ee14219523534ec69 (patch)
treec9a5e2a6e742f4dab84fc91fab4600fc2c7ae539 /gcc/fortran
parent6ce3d791dfcba469e709935aba5743640f7d4959 (diff)
downloadgcc-5c715e6a2990cfb6c15acc1ee14219523534ec69.zip
gcc-5c715e6a2990cfb6c15acc1ee14219523534ec69.tar.gz
gcc-5c715e6a2990cfb6c15acc1ee14219523534ec69.tar.bz2
PR fortran/95373 - ICE in build_reference_type, at tree.c:7942
The use of KIND, LEN, RE, and IM inquiry references for applicable intrinsic types is valid only for suffienctly new Fortran standards. Add appropriate check. 2020-05-28 Harald Anlauf <anlauf@gmx.de> gcc/fortran/ PR fortran/95373 * primary.c (is_inquiry_ref): Check validity of inquiry references against selected Fortran standard. gcc/testsuite/ PR fortran/95373 * gfortran.dg/pr95373_1.f90: New test. * gfortran.dg/pr95373_2.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/primary.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index d738984..67105cc 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1998,6 +1998,28 @@ is_inquiry_ref (const char *name, gfc_ref **ref)
else
return false;
+ switch (type)
+ {
+ case INQUIRY_RE:
+ case INQUIRY_IM:
+ if (!gfc_notify_std (GFC_STD_F2008, "RE or IM part_ref at %C"))
+ return false;
+ break;
+
+ case INQUIRY_KIND:
+ if (!gfc_notify_std (GFC_STD_F2003, "KIND part_ref at %C"))
+ return false;
+ break;
+
+ case INQUIRY_LEN:
+ if (!gfc_notify_std (GFC_STD_F2003, "LEN part_ref at %C"))
+ return false;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
if (ref)
{
*ref = gfc_get_ref ();