Internal compiler error with TRIM function

I am compiling a large project and the f90 compiler incurred in the following error

PGF90-S-0000-Internal compiler error. string_expr_length: ast not string op 14 (dtpm_if.f90: 220)
2 inform, 23 warnings, 1 severes, 0 fatal for dtpm_if
PGF90/x86-64 Windows 12.10-0: compilation completed with severe errors

The faulty line seems to be

VUL_OP_FILEROOT = ‘________________’
VUL_OP_FILEROOT(2:MIN(15,LEN_TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID))) &
= TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID)

but this compiles just fine with Intel 2005 fortran compiler. What is going on here?

I am using PGI fortran compiler 12.10.

Thanks beforehand.

Hi Jon,

What is going on here?

An Internal Compiler Error (ICE) is always a problem with the compiler, though without a reproducing example we can’t tell exactly what’s wrong.

I do see one similar ICE in a problem report (TPR#19443) which has been fixed in 13.7. Can you try installing 13.7 and see if your issue was the same problem? If not, can you please send a report to PGI Customer Service (trs@pgroup.com)?

Thanks,
Mat

Hi Mat,

Thanks for the prompt reply. I have downloaded a trial license for 13.7 and tried to recompile. I have got the same identical error to the same offending line that I reported in my preceding post. Unfortunately, I cannot send my code out for you to check but it seems that your compiler has some serious concerns in managing the TRIM function when called by other functions. As I said before, the old Intel 2005 fortran compiler has no problem to manage this but our aim is just to port the code to a different platform with a different compiler and yours has given to us satisfactory results for other applications (mostly for accelerating code). I hope this could be useful to you also if the information is forcefully limited.

Regards,

Jon

Hi Jon,

Instead of the full code, it it possible to send us a small example with reproduces the problem?

Thanks,
Mat

Dear Mat,

I have managed to get a few lines of code, extracted from the offending one, that reproduce the error. Here is:

      SUBROUTINE TEST

      IMPLICIT NONE
      SAVE
	  
      INTEGER          :: NULL
      INTEGER          :: ERROR, I, J
      CHARACTER(80)    :: EX_TITLE
      CHARACTER(15)    :: VUL_OP_FILEROOT
      CHARACTER(80)    :: STUDY_ID
      CHARACTER(2)     :: EX_LETTER
      CHARACTER(3)     :: NUMBER
               
               DO J = 1,10
                  VUL_OP_FILEROOT = '________________'
                  VUL_OP_FILEROOT(2:MIN(15,LEN_TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID))) &
                                  = TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID)
                   DO I=1,20
                       NULL = 0
                       WRITE(NUMBER,'(I2)')I
                       NUMBER=ADJUSTL(NUMBER)
                   ENDDO
                   DO I=1,15
                       NULL = 0
                       NUMBER=ADJUSTL(NUMBER)
                   ENDDO
                   NULL = 0
               END DO

      RETURN

      END SUBROUTINE TEST

Hope this will help to improve your really fine product.

Jon

Hi John,

It looks like its the second “CHAR(J+48)” that the compiler is choking on. I’ll send in a report once our issue tracking system is back up. As a work around, can you try the following:

      SUBROUTINE TEST

      IMPLICIT NONE
      SAVE

      INTEGER          :: NULL
      INTEGER          :: ERROR, I, J
      CHARACTER(80)    :: EX_TITLE
      CHARACTER(15)    :: VUL_OP_FILEROOT
      CHARACTER(80)    :: STUDY_ID
      CHARACTER(2)     :: EX_LETTER
      CHARACTER(3)     :: NUMBER
      CHARACTER        :: J48

               DO J = 1,10
                  J48=CHAR(J+48)
                  VUL_OP_FILEROOT = '________________'
                  VUL_OP_FILEROOT(2:MIN(15,LEN_TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID))) &
                                   = TRIM(J48//TRIM(EX_LETTER)//STUDY_ID)
!                  VUL_OP_FILEROOT(2:MIN(15,LEN_TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID))) &
!                                   = TRIM(CHAR(J+48)//TRIM(EX_LETTER)//STUDY_ID)
                    DO I=1,20
                       NULL = 0
                       WRITE(NUMBER,'(I2)')I
                       NUMBER=ADJUSTL(NUMBER)
                   ENDDO
                   DO I=1,15
                       NULL = 0
                       NUMBER=ADJUSTL(NUMBER)
                   ENDDO
                   NULL = 0
               END DO

      RETURN

      END SUBROUTINE TEST

Thanks,
Mat