Bug 84385 - [F03] Reject invalid SELECT TYPE selector (allocate_with_source_22.f03)
Summary: [F03] Reject invalid SELECT TYPE selector (allocate_with_source_22.f03)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: janus
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 84094
  Show dependency treegraph
 
Reported: 2018-02-14 18:15 UTC by janus
Modified: 2018-02-14 21:49 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-02-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2018-02-14 18:15:45 UTC
https://github.com/nncarlson/gfortran.dg/issues/6

allocate_with_source_22.f03 violates F03:C811 ( = F08:C835). There is a check for this clause in gfc_match_select_type, which apparently fails for that case.
Comment 1 janus 2018-02-14 19:20:09 UTC
Draft patch:


Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c	(revision 257635)
+++ gcc/fortran/match.c	(working copy)
@@ -6201,6 +6201,7 @@ gfc_match_select_type (void)
 		     || CLASS_DATA (expr1)->attr.codimension)
 		 && expr1->ref
 		 && expr1->ref->type == REF_ARRAY
+		 && expr1->ref->u.ar.type == AR_FULL
 		 && expr1->ref->next == NULL);
 
   /* Check for F03:C811.  */
Comment 2 janus 2018-02-14 21:47:31 UTC
Author: janus
Date: Wed Feb 14 21:46:59 2018
New Revision: 257673

URL: https://gcc.gnu.org/viewcvs?rev=257673&root=gcc&view=rev
Log:
2018-02-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/84385
	* match.c (gfc_match_select_type): Fix check for selector in
	SELECT TYPE statement.


2018-02-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/84385
	* gfortran.dg/allocate_with_source_22.f03: Fix invalid test case.
	* gfortran.dg/allocate_with_source_23.f90: Ditto.
	* gfortran.dg/select_type_1.f03: Extend test case.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/allocate_with_source_22.f03
    trunk/gcc/testsuite/gfortran.dg/allocate_with_source_23.f03
    trunk/gcc/testsuite/gfortran.dg/select_type_1.f03
Comment 3 janus 2018-02-14 21:49:54 UTC
Fixed with r257673. Closing.