Bug 26586 - g77 -pedantic wrongly rejecting statement function
Summary: g77 -pedantic wrongly rejecting statement function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-03-06 22:47 UTC by john.harper
Modified: 2006-03-06 22:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.2.3 3.3.2 3.3.3 3.4.0 3.0.4
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description john.harper 2006-03-06 22:47:01 UTC
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] %
Comment 1 Andrew Pinski 2006-03-06 22:56:18 UTC
Fixed in 4.0.0 with the gfortran rewrite.  3.4.6 is about to be released and there is almost no way to get a non regression fixed.

So closing as fixed for 4.0.0.