Bug 82865 - Option -fdec collides with PDT
Summary: Option -fdec collides with PDT
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Fritz Reese
URL:
Keywords:
Depends on:
Blocks: PDT
  Show dependency treegraph
 
Reported: 2017-11-06 17:46 UTC by G. Steinmetz
Modified: 2018-07-16 18:49 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-06-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2017-11-06 17:46:06 UTC
Several testsuite files ./gcc/testsuite/gfortran.dg/pdt_*
are producing extra error messages when combined with option -fdec.
One short example :


$ cat z1.f90
program p
   type t(a)
      integer, len :: a
   end type
end


$ gfortran-8-20171105 -c z1.f90
$
$ gfortran-8-20171105 -c z1.f90 -fdec
z1.f90:3:18:

       integer, len :: a
                  1
Error: Attribute at (1) is not allowed outside a TYPE definition
z1.f90:4:6:

    end type
      1
Error: Expecting END PROGRAM statement at (1)
z1.f90:2:7:

    type t(a)
       1
Error: FORMAT tag at (1) must be of type default-kind CHARACTER or of INTEGER
Comment 1 Dominique d'Humieres 2017-11-06 19:17:57 UTC
Confirmed: never mix f77 extensions with post f90 syntax!-(
Comment 2 Jerry DeLisle 2017-11-06 19:42:39 UTC
This gets into philosophical issue.  The intent of -fdec was to allow old DEC codes to be compiled. Old DEC codes do not have PDT.  Any newer codes that use PDT should never use -fdec. I vote Invalid or Wont fix resolution.
Comment 3 Thomas Koenig 2017-11-06 22:26:08 UTC
(In reply to Jerry DeLisle from comment #2)
> This gets into philosophical issue.  The intent of -fdec was to allow old
> DEC codes to be compiled. Old DEC codes do not have PDT.  Any newer codes
> that use PDT should never use -fdec. I vote Invalid or Wont fix resolution.

I concur. Maybe we should document this in the manual or
throw a hard error if a PDT is discovered with one of the dec options
is in place.
Comment 4 Jerry DeLisle 2017-11-07 02:45:38 UTC
I would be OK with a hard error. If so, we need to think about any other similir situations with other modern fortran features. Then we get into a game of chasing more rabits. Perhaps best to document and just say that -fdec it is known to be incompatible with some constructs such as PDT and should not be mixed with modern fortran.
Comment 5 Paul Thomas 2017-11-30 18:47:28 UTC
I agree with the general sentiment that this should probably be a WONT FIX. However, it is concerning that there is an interaction.

I will put this on on side as one of the longer term TODOs.

Paul
Comment 6 Fritz Reese 2018-06-27 19:27:06 UTC
Actually this is due to gfc_match_type() failing to account for PDT declarations. The function was introduced in r241518 to allow using TYPE as an alias for PRINT with -fdec but was not updated when PDT support was introduced in r251925. Though I agree -fdec should rarely be mixed with new Fortran, it is actually simple to patch gfc_match_type() so that it does match PDTs as a TYPE/PRINT statement. I will submit a patch shortly.
Comment 7 Fritz Reese 2018-06-27 19:36:26 UTC
(In reply to Fritz Reese from comment #6)
> ... Though I agree -fdec should rarely be mixed with new
> Fortran, it is actually simple to patch gfc_match_type() so that it does
> match PDTs as a TYPE/PRINT statement. ...

s/does/does NOT/
Comment 8 Fritz Reese 2018-06-28 15:31:56 UTC
Author: foreese
Date: Thu Jun 28 15:31:24 2018
New Revision: 262221

URL: https://gcc.gnu.org/viewcvs?rev=262221&root=gcc&view=rev
Log:
2018-06-28  Fritz Reese  <fritzoreese@gmail.com>

    gcc/fortran/ChangeLog:

	PR fortran/82865
	* decl.c (gfc_match_type): Refactor and check for PDT declarations.

    gcc/testsuite/ChangeLog:

	PR fortran/82865
	* gfortran.dg/dec_type_print_2.f03: New testcase.


Added:
    trunk/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 9 Fritz Reese 2018-06-28 15:41:22 UTC
Fixed in r262221
Comment 10 Fritz Reese 2018-06-28 16:47:51 UTC
Author: foreese
Date: Thu Jun 28 16:47:19 2018
New Revision: 262223

URL: https://gcc.gnu.org/viewcvs?rev=262223&root=gcc&view=rev
Log:
2018-06-28  Fritz Reese  <fritzoreese@gmail.com>

    gcc/testsuite/ChangeLog:

	PR fortran/82865
	Backport from trunk.
	* gfortran.dg/dec_type_print_2.f03: New testcase.

    gcc/fortran/ChangeLog:

	PR fortran/82865
	Backport from trunk.
	* decl.c (gfc_match_type): Refactor and check for PDT declarations.


Added:
    branches/gcc-8-branch/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
Modified:
    branches/gcc-8-branch/   (props changed)
    branches/gcc-8-branch/contrib/mklog.pl   (props changed)
    branches/gcc-8-branch/gcc/ada/libgnarl/s-interr__hwint.adb   (props changed)
    branches/gcc-8-branch/gcc/fortran/ChangeLog
    branches/gcc-8-branch/gcc/fortran/decl.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog

Propchange: branches/gcc-8-branch/
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-8-branch/contrib/mklog.pl
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-8-branch/gcc/ada/libgnarl/s-interr__hwint.adb
            ('svn:mergeinfo' modified)
Comment 11 Fritz Reese 2018-06-28 16:51:55 UTC
Author: foreese
Date: Thu Jun 28 16:51:23 2018
New Revision: 262224

URL: https://gcc.gnu.org/viewcvs?rev=262224&root=gcc&view=rev
Log:
2018-06-28  Fritz Reese  <fritzoreese@gmail.com>

    gcc/testsuite/ChangeLog:

	PR fortran/82865
	Backport from trunk.
	* gfortran.dg/dec_type_print_2.f03: New testcase.

    gcc/fortran/ChangeLog:

	PR fortran/82865
	Backport from trunk.
	* decl.c (gfc_match_type): Refactor and check for PDT declarations.


Added:
    branches/gcc-7-branch/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
      - copied unchanged from r262221, trunk/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
Modified:
    branches/gcc-7-branch/   (props changed)
    branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb   (props changed)
    branches/gcc-7-branch/gcc/fortran/ChangeLog
    branches/gcc-7-branch/gcc/fortran/decl.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
    branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb   (props changed)

Propchange: branches/gcc-7-branch/
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb
            ('svn:mergeinfo' modified)
Comment 12 Fritz Reese 2018-06-29 20:30:06 UTC
Author: foreese
Date: Fri Jun 29 20:29:34 2018
New Revision: 262260

URL: https://gcc.gnu.org/viewcvs?rev=262260&root=gcc&view=rev
Log:
Revert r262224 (backport of r262221) as PDTs are not supported in 7-branch.

gcc/fortran/ChangeLog:
-2018-06-28  Fritz Reese  <fritzoreese@gmail.com>
-
-	PR fortran/82865
-	Backport from trunk.
-	* decl.c (gfc_match_type): Refactor and check for PDT declarations.
-

gcc/testsuite/ChangeLog:
-2018-06-28  Fritz Reese  <fritzoreese@gmail.com>
-
-	PR fortran/82865
-	Backport from trunk.
-	* gfortran.dg/dec_type_print_2.f03: New testcase.
-

Removed:
    branches/gcc-7-branch/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
Modified:
    branches/gcc-7-branch/   (props changed)
    branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb   (props changed)
    branches/gcc-7-branch/gcc/fortran/ChangeLog
    branches/gcc-7-branch/gcc/fortran/decl.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
    branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb   (props changed)

Propchange: branches/gcc-7-branch/
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb
            ('svn:mergeinfo' modified)
Comment 13 Rainer Orth 2018-07-02 10:16:27 UTC
(In reply to Fritz Reese from comment #12)
> Author: foreese
> Date: Fri Jun 29 20:29:34 2018
> New Revision: 262260
> 
> URL: https://gcc.gnu.org/viewcvs?rev=262260&root=gcc&view=rev
> Log:
> Revert r262224 (backport of r262221) as PDTs are not supported in 7-branch.
> 
> gcc/fortran/ChangeLog:
> -2018-06-28  Fritz Reese  <fritzoreese@gmail.com>
> -
> -	PR fortran/82865
> -	Backport from trunk.
> -	* decl.c (gfc_match_type): Refactor and check for PDT declarations.
> -
> 
> gcc/testsuite/ChangeLog:
> -2018-06-28  Fritz Reese  <fritzoreese@gmail.com>
> -
> -	PR fortran/82865
> -	Backport from trunk.
> -	* gfortran.dg/dec_type_print_2.f03: New testcase.
> -
> 
> Removed:
>     branches/gcc-7-branch/gcc/testsuite/gfortran.dg/dec_type_print_2.f03
> Modified:
>     branches/gcc-7-branch/   (props changed)
>     branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb   (props changed)
>     branches/gcc-7-branch/gcc/fortran/ChangeLog
>     branches/gcc-7-branch/gcc/fortran/decl.c
>     branches/gcc-7-branch/gcc/testsuite/ChangeLog
>     branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb   (props changed)
> 
> Propchange: branches/gcc-7-branch/
>             ('svn:mergeinfo' modified)
> 
> Propchange: branches/gcc-7-branch/gcc/ada/s-interr-hwint.adb
>             ('svn:mergeinfo' modified)
> 
> Propchange: branches/gcc-7-branch/gcc/testsuite/gnat.dg/opt65.adb
>             ('svn:mergeinfo' modified)

It seems the backport caused a caused quite a number on testsuite failures
on the gcc-7 branch:

+FAIL: gfortran.dg/dec_type_print_2.f03   -O0  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -O0  compilation failed to produce executable
+FAIL: gfortran.dg/dec_type_print_2.f03   -O1  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -O1  compilation failed to produce executable
+FAIL: gfortran.dg/dec_type_print_2.f03   -O2  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -O2  compilation failed to produce executable
+FAIL: gfortran.dg/dec_type_print_2.f03   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to produce executable
+FAIL: gfortran.dg/dec_type_print_2.f03   -O3 -g  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -O3 -g  compilation failed to produce executable
+FAIL: gfortran.dg/dec_type_print_2.f03   -Os  (test for excess errors)
+UNRESOLVED: gfortran.dg/dec_type_print_2.f03   -Os  compilation failed to produce executable

Excess errors:
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:12:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:13:12: Error: Invalid character in name at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:14:12: Error: Invalid character in name at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:15:16: Error: Symbol 'i' at (1) already has basic type of INTEGER
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:16:17: Error: Symbol 'a' at (1) has no IMPLICIT type
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:18:5: Error: Expecting END PROGRAM statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:20:13: Error: Derived type 'mytype' at (1) is being used before it is defined
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:21:13: Error: Derived type 'mytype' at (1) is being used before it is defined
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:23:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:24:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:25:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:26:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:27:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:28:2: Error: Unclassifiable statement at (1)
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:30:5: Error: Symbol 'z2' at (1) has no IMPLICIT type
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:31:5: Error: Symbol 'z2' at (1) has no IMPLICIT type
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:38:15: Error: Derived type 'mytype' at (1) is being used before it is defined
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:39:12: Error: Symbol 'arg' at (1) has no IMPLICIT type
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:40:20: Error: Symbol 'arg' at (1) has no IMPLICIT type
/vol/gcc/src/hg/gcc-7-branch/local/gcc/testsuite/gfortran.dg/dec_type_print_2.f03:41:24: Error: Symbol 'arg' at (1) has no IMPLICIT type

Im seeing this on Solaris/SPARC and x86, both 32 and 64-bit, and there are also
gcc-testresults reports on i586-unknown-freebsd10.4, powerpc64-unknown-linux-gnu,
  powerpc64le-unknown-linux-gnu

Besides, all those svn property changes are at least unrelated.

  Rainer
Comment 14 Fritz Reese 2018-07-02 11:16:33 UTC
(In reply to Rainer Orth from comment #13)
> 
> It seems the backport caused a caused quite a number on testsuite failures
> on the gcc-7 branch:
> ...

I reverted the backport in r262260. Are you certain that you still see those errors after the reversion? That testcase file should no longer exist in the tree.

> 
> Besides, all those svn property changes are at least unrelated.
> 
>   Rainer

That is what I suspected. ‘svn merge’ added them for some reason (even from a clean tree). I’ll make sure to keep those out of future merges.
Comment 15 Fritz Reese 2018-07-16 18:49:38 UTC
Marking as resolved again since the 7-branch backport was reverted; the patch is applied to trunk and 8-branch.