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

            Bug ID: 126292
           Summary: abnormal compilation time
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mfvalin at gmail dot com
  Target Milestone: ---

the following code takes an abnormally long time to compile (order 10+ minutes)
with other compilers it takes less than a quarter of a second

 > gfortran --version
GNU Fortran (GCC) 16.1.0
(versions 14/15 of the compiler behave the same way)
(9.4.0 compiles at a "normal" speed)

with -DFAST the compile time with gfortran becomes "normal"

the problem looks similar to what was addressed in ID 20923
regression ?

MODULE DEMO
  IMPLICIT NONE
  INTEGER, PARAMETER :: JPRB = SELECTED_REAL_KIND(13,300) !< Standard real type
  REAL(KIND=JPRB) :: TACOS2(0:35250)
END MODULE
SUBROUTINE BUGGED( ERR)
  USE DEMO
  IMPLICIT NONE
  INTEGER :: ERR
  INTEGER :: I

  ERR = 0
#if !defined(FAST)
  TACOS2      = ACOS( (/ (I, I=   64000,    99250) /) /  100000.0_JPRB)
  ! gfortran takes a very long time to compile the above line
#else
  DO I = 64000, 99250
    TACOS2(I-64000) = ACOS(REAL(I, KIND=JPRB) / 100000.0_JPRB)
  ENDDO
  ! the above loop compiles normally
#endif

END SUBROUTINE BUGGED

Reply via email to