Coming back to my original question: SPAG is supposed to convert the COMMON blocks into modules, but it does not always happen correctly due to a regression bug:
Although the modules for COMMON blocks are successfully created and used in the function, the old COMMON blocks are not always removed. The variable declarations for the COMMON blocks are also not removed.
For example:
SUBROUTINE xipfl
   USE C_PASSER
   USE C_XGPI2
   USE C_XGPI4
   USE C_XGPIC
   USE C_ZZZZZZ
   IMPLICIT NONE
   INTEGER Bcdcnt , Dmap(1) , Dmpcnt , Dmppnt , Iallon , Ichar , Icold , Icomon , Icrdtp , Idmpnt , Iequl , Insert , Irturn ,       &
         & Isavdw , Iseqn , Isgnon , Islsh , Istopf , Ldmap , Length , Lmpl , Maskhi , Masklo , Masks(1) , Modidx , Modnam , Mpl(1) &
         & , Mplpnt , Nbegin , Nblank , Nbpc , Nchkpt , Ncond , Ncpw , Ndiag , Ndmap , Nend , Nequiv , Nestm1 , Nestm2 , Newcrd ,   &
         & Nexit , Njump , Nosgn , Noutpt , Npurge , Nrept , Nsave , Nsol , Ntime , Nwpc , Nxequi , oscar(1) , ospnt
   REAL Core(1)
   COMMON /passer/ Istopf , Modnam , Icomon
   COMMON /xgpi2 / Lmpl , Mplpnt , Mpl
   COMMON /xgpi4 / Irturn , Insert , Iseqn , Dmpcnt , Idmpnt , Dmppnt , Bcdcnt , Length , Icrdtp , Ichar , Newcrd , Modidx , Ldmap ,&
                 & Isavdw , Dmap
   COMMON /xgpic / Icold , Islsh , Iequl , Nblank , Nxequi , Ndiag , Nsol , Ndmap , Nestm1 , Nestm2 , Nexit , Nbegin , Nend ,       &
                 & Njump , Ncond , Nrept , Ntime , Nsave , Noutpt , Nchkpt , Npurge , Nequiv , Ncpw , Nbpc , Nwpc , Maskhi ,        &
                 & Masklo , Isgnon , Nosgn , Iallon , Masks
   COMMON /zzzzzz/ Core
   INTEGER andf , orf
   INTEGER i , iofl , ityp , j , k , k1 , k2 , k3 , l
   EXTERNAL andf , orf
   INTEGER :: spag_nextblock_1
   spag_nextblock_1 = 1
...
Note: this bug is a regression against SPAG 7.61. Version 7.61 is able to properly remove all COMMON blocks always, however it crashes sometimes due to other reasons.
The old COMMON blocks are supposed to be removed, but it happens only for some files, and does not happen for the others. I was not able to track down the reason of this. There is no warning or code content that obviously triggers COMMON blocks removal to cease. One clear observation is: the COMMON blocks are either all removed, or all persist.
This is not a critical issue, I should still be able to run SPAG-7.61 for the problematic sources, and in those that crash 7.61 cut the remaining COMMON blocks with some extra scripting. The harder part is to parse and remove the declarations for the COMMON blocks as well.
But this issue produces an invalid source code that could not be compiled anymore due to conflicting declarations. Most notably, it’s a regression!!
@apple3feet I’m attaching the sample sources for investigation: in 8.01 xipfl.f90 has a bug, pktri1.f90 does not have a bug. In 7.61 both do not have a bug.
xipfl.f90 (4.3 KB)
pktri1.f90 (6.4 KB)