https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126234

            Bug ID: 126234
           Summary: [17 Regression] gfortran reject SPEC CPU wrf and wrf_r
                    since
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pheeck at gcc dot gnu.org
                CC: jvdelisle at gcc dot gnu.org
            Blocks: 26163
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

GCC rejects both the SPEC CPU 2006 benchmark wrf and the SPEC CPU 2017
benchmark wrf_r.  For example wrf_r:

gfortran -c -I. -I./netcdf/include -I./inc -O0 -std=legacy
module_pbl_driver.fppized.f90

module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘a1’ at (1) is an ambiguous reference to ‘a1’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘a2s’ at (1) is an ambiguous reference to ‘a2s’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘a2x’ at (1) is an ambiguous reference to ‘a2x’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘a3s’ at (1) is an ambiguous reference to ‘a3s’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘a4s’ at (1) is an ambiguous reference to ‘a4s’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1
Error: Name ‘adnh’ at (1) is an ambiguous reference to ‘adnh’ from module
‘module_bl_myjpbl’
module_pbl_driver.fppized.f90.orig.f90:107:8:

  107 |    USE module_bl_qnsepbl09
      |        1

and so on...

Bisected to

commit f935a7a9013d0748ba1f42dc532df3d278707bf6
Author:     Jerry DeLisle <[email protected]>
AuthorDate: Thu Jul 9 19:24:49 2026 -0700
Commit:     Jerry DeLisle <[email protected]>
CommitDate: Fri Jul 10 11:06:39 2026 -0700

    fortran: [PR126170] Fix LTO ICE in copy_function_or_variable

I've noticed

commit 69a2daacba6353d1aab3118415b89afd479c4c76
Author:     Jerry DeLisle <[email protected]>
AuthorDate: Sat Jul 11 10:35:29 2026 -0700
Commit:     Jerry DeLisle <[email protected]>
CommitDate: Sat Jul 11 10:39:34 2026 -0700

    fortran: [PR126210] Restrict host-assoc symbol skip to derived types

but this fix doesn't seem to help here.

I reduced module_pbl_driver.fppized.f90, but my experience with Fortran is very
limited so I wasn't able to reduce the other files required to reproduce this.

---- reduced module_pbl_driver.fppized.f90 ----
CONTAINS    
SUBROUTINE pbl_driver(                                                         
   ims                                  ,scalar,tracer                        
)    
   USE module_state_description                                                 
   USE module_bl_qnsepbl09    
   USE module_bl_acm    
   USE module_bl_myjurb    
   REAL,       DIMENSION( ims)    ::                         rho, dz8w    
   REAL,       DIMENSION( ims)    ::                       EXCH_H,EXCH_M    
   REAL ,DIMENSION(:)   :: tracer    
    REAL ,DIMENSION(:)   :: scalar    
    REAL ,DIMENSION(ims)   :: scalar_tend    
     LOGICAL run_param    
 IF (run_param) THEN    
    DO ij = 1 , ENDDO    
      IF (bl_pbl_physics .EQ. QNSEPBLSCHEME ) THEN    
       CALL diff4d  (DTdtbl,dz8w, scalar, .true. 
,rho,EXCH_H,EXCH_M,SCALAR_TEND,num_scalar, param_first_scalar
,IDS,ide,jds,jde,kds,KDE,IMS,ime,jms,jme,kms,KME,its,ite,jts,jte,kts,KTE)    
          CALL diff4d  (DTdtbl,dz8w, tracer, .false.  ,rho,EXCH_H,exch_m       
        ,SCALAR_TEND,num_tracer,
PARAM_FIRST_SCALAR,ids,IDE,jds,jde,kds,KDE,ims,ime,jms,jme,kms,KME,its,ite,jts,jte,kts,kte)
          ENDIF    
   ENDDO    
   ENDIF    
   END    
          SUBROUTINE diff4d(DT,DZ,SCALAR,IS_SCALAR,RHO             
,EXCH_H,EXCH_M  ,SCALAR_TEND    ,NUM_SCALAR, PARAM_FIRST_SCALAR    
,IDS,IDE,JDS,JDE,KDS,KDE      ,IMS,IME,JMS,JME,KMS,KME     
,ITS,ITE,JTS,JTE,KTS,KTE      )
      INTEGER PARAM_FIRST_SCALAR    
      LOGICAL IS_SCALAR    
      REAL,DIMENSION(IMS) :: DZ    
      REAL,DIMENSION(KMS) :: SCALAR    
      REAL,DIMENSION(:) :: RHO    
      REAL,DIMENSION(IMS) :: EXCH_H    
      REAL,DIMENSION(IMS) :: EXCH_M    
      REAL,DIMENSION(JMS) :: SCALAR_TEND    
      END    
END
---- ----


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2026, 2k17, 2k and 2k6 and
95)

Reply via email to