The following Fortran 77 program declares and uses a statement function 
I2C(M). When compiled with these options:
  g77 -pedantic -v -save-temps 
it is misread as a character substring with its : missing, but IMHO
this statement function is valid in Fortran 77. The program compiles 
and runs OK if the -pedantic is removed. Below are the program listing, 
the compiler output, and the .s file generated by the compiler. 
There was no .i* file.

          tahi[~/Jfh] % cat testsf.f
      PROGRAM TESTSF
      CHARACTER I2C*2, CDIGIT(0:9)*1
      DATA CDIGIT/'0','1','2','3','4','5','6','7','8','9'/
* Statement function I2C to convert integer 0 to 99 to character*2
      I2C(M)   = CDIGIT(M/10) // CDIGIT(MOD(M,10))
* End of statement functions; start of executables
      PRINT '(10A3)', (I2C(M),M=0,99)
      END
tahi[~/Jfh]
tahi[~/Jfh] % g77 -pedantic -v -save-temps testsf.f
Driving: g77 -pedantic -v -save-temps testsf.f -lfrtbegin -lg2c -lm
-shared-libgcc
Reading specs from /usr/pkg/gcc3/lib/gcc-lib/sparc-sun-solaris2/3.3.4/specs
Configured with: ./configure --prefix=/usr/pkg/gcc3 --host=sparc-sun-solaris2
--enable-shared --enable-languages=f77
Thread model: posix
gcc version 3.3.4
 /usr/pkg/gcc3/lib/gcc-lib/sparc-sun-solaris2/3.3.4/f771 testsf.f -quiet
-dumpbase testsf.f -auxbase testsf -pedantic -version -o testsf.s
GNU F77 version 3.3.4 (sparc-sun-solaris2)
        compiled by GNU C version 3.3.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
testsf.f: In program `testsf':
testsf.f:5:
         I2C(M)   = CDIGIT(M/10) // CDIGIT(MOD(M,10))
         1    2
Missing colon as of (2) in substring reference for (1)
testsf.f:7:
         PRINT '(10A3)', (I2C(M),M=0,99)
                          1    2
Missing colon as of (2) in substring reference for (1)
tahi[~/Jfh] %          
tahi[~/Jfh] % cat testsf.s
        .file   "testsf.f"
        .section        ".data"
        .align 8
        .type   cdigit.0, #object
        .size   cdigit.0, 10
cdigit.0:
        .ascii  "0"
        .ascii  "1"
        .ascii  "2"
        .ascii  "3"
        .ascii  "4"
        .ascii  "5"
        .ascii  "6"
        .ascii  "7"
        .ascii  "8"
        .ascii  "9"
        .global .rem
        .global .div
        .section        ".rodata"
        .align 8
.LLC1:
        .asciz  "(10A3)"
        .section        ".data"
        .align 4
        .type   __g77_cilist_0.1, #object
        .size   __g77_cilist_0.1, 20
__g77_cilist_0.1:
        .long   0
        .long   6
        .long   0
        .long   .LLC1
        .long   0
        .ident  "GCC: (GNU) 3.3.4"
tahi[~/Jfh] %


-- 
           Summary: g77 -pedantic wrongly rejecting statement function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot harper at vuw dot ac dot nz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26586

Reply via email to