public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32386]  New: Pure function not allowed in specification expression
@ 2007-06-18  0:42 john dot harper at vuw dot ac dot nz
  2007-06-18  1:01 ` [Bug fortran/32386] " jvdelisle at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: john dot harper at vuw dot ac dot nz @ 2007-06-18  0:42 UTC (permalink / raw)
  To: gcc-bugs

The following program seems to me to be valid Fortran 95, because the f95
standard 5.1.1.5 and 7.1.6.2 say a CHARACTER(n) declaration is OK if n is a
scalar integer restricted expression, in which each primary is a constant,
the intrinsic LEN is allowed, and so are pure functions that are not intrinsic,
not internal, not statement functions, do not have dummy procedure arguments,
and are not recursive. But gfortran won't compile it. Evidence: 

harper@RHEL5 test system: ~/Jfh/Test 52 >cat testspec.f90
MODULE halvestring ! Can halfit be in a specification expression?
CONTAINS
  PURE FUNCTION halfit(s1) RESULT (s2)
    CHARACTER(*),INTENT(IN):: s1
    CHARACTER(len(s1)/2) :: s2
    s2 = s1
  END FUNCTION halfit
END MODULE halvestring
! -----------
PROGRAM testspec
USE  halvestring
CHARACTER(*),PARAMETER :: stringa = 'abcdeedcba'
CHARACTER(len(halfit(stringa))) :: stringb

stringb = halfit(stringa)
PRINT "(I4,A)", len(stringb),' "'//stringb//'"' !   5 "abcde"
END PROGRAM testspec

harper@RHEL5 test system: ~/Jfh/Test 53 >gfortran -v testspec.f90
Driving: gfortran -v testspec.f90 -lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
 /usr/libexec/gcc/i386-redhat-linux/4.1.1/f951 testspec.f90 -quiet -dumpbase
testspec.f90 -mtune=generic -auxbase testspec -version -I
/usr/lib/gcc/i386-redhat-linux/4.1.1/finclude -o /tmp/ccUf0R9I.s
GNU F95 version 4.1.1 20070105 (Red Hat 4.1.1-52) (i386-redhat-linux)
        compiled by GNU C version 4.1.1 20070105 (Red Hat 4.1.1-52).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 In file testspec.f90:13

CHARACTER(len(halfit(stringa))) :: stringb
                                         1
Error: 'stringb' at (1) must have constant character length in this context
harper@RHEL5 test system: ~/Jfh/Test 54 >


-- 
           Summary: Pure function not allowed in specification expression
           Product: gcc
           Version: 4.1.1
            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
 GCC build triplet: ?
  GCC host triplet: ?
GCC target triplet: i386-redhat-linux


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-06-19  3:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18  0:42 [Bug fortran/32386] New: Pure function not allowed in specification expression john dot harper at vuw dot ac dot nz
2007-06-18  1:01 ` [Bug fortran/32386] " jvdelisle at gcc dot gnu dot org
2007-06-18  1:46 ` kargl at gcc dot gnu dot org
2007-06-18  2:43 ` John dot Harper at mcs dot vuw dot ac dot nz
2007-06-18  2:44 ` John dot Harper at mcs dot vuw dot ac dot nz
2007-06-18  4:13 ` jvdelisle at gcc dot gnu dot org
2007-06-18  4:26 ` kargl at gcc dot gnu dot org
2007-06-18 22:49 ` pault at gcc dot gnu dot org
2007-06-19  1:14 ` John dot Harper at mcs dot vuw dot ac dot nz
2007-06-19  3:51 ` kargl at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).