public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52062] New: [4.6.2 regression] public generic name, specific functions of private types
@ 2012-01-31  1:06 john.harper at vuw dot ac.nz
  2012-01-31  8:13 ` [Bug fortran/52062] " kargl at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: john.harper at vuw dot ac.nz @ 2012-01-31  1:06 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52062
           Summary: [4.6.2 regression] public generic name, specific
                    functions of private types
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: john.harper@vuw.ac.nz


A program that compiles and runs with gfortran 4.4.4 but gives an internal
compiler error with gfortran 4.6.2. IMHO the program is bad f95 but good f2003
because it disobeys a f95 constraint that seems not to be a f2003 constraint.
Evidence: 
rimu[~]$ cat testpublic.f90
! Can a public generic name refer to private specific functions returning
! private types? (F95 standard 5.2.3 R523 3rd constraint: A module procedure 
! that has a dummy argument or function result of a type that has PRIVATE 
! accessibility shall have PRIVATE accessibility and shall not have a 
! generic identifier that has PUBLIC accessibility. That constraint is 
! not in f2003 so this program seems to be valid f2003 but bad f95.)
Module whattype
  private
  public datatype
  interface datatype
     module procedure rtype,chtype
  end interface datatype
  type char1int
     character(9) name
     integer      sort
  end type char1int
  type char2int
     character(9) name
     integer      sort
     integer      leng
  end type char2int
contains
  elemental type(char1int) function rtype(x)
    real,intent(in)::                     x
    rtype = char1int('real',kind(x))
  end function rtype

  elemental type(char2int) function chtype(x)
    Character(*),intent(in)::              x
    chtype = char2int('character',kind(x),len(x))
  end function chtype

end module whattype

program testpublic
  use whattype
  print 999, ' "rhubarb" is ',datatype("rhubarb")
  print 999, ' 666.0     is ',datatype(666.0)
999 format (2A,' kind = ',I0,:,' len = ',I0)
end program testpublic

rimu[~]$ gfortran -v
Using built-in specs.
Target: i386-redhat-linux6E
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --disable-gnu-unique-object
--enable-languages=c,c++,fortran --disable-libgcj
--with-mpfr=/builddir/build/BUILD/gcc-4.4.4-20100726/obj-i386-redhat-linux6E/mpfr-install/
--with-ppl=/builddir/build/BUILD/gcc-4.4.4-20100726/obj-i386-redhat-linux6E/ppl-install
--with-cloog=/builddir/build/BUILD/gcc-4.4.4-20100726/obj-i386-redhat-linux6E/cloog-install
--with-tune=generic --with-arch=i586 --build=i386-redhat-linux6E
Thread model: posix
gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) 
rimu[~]$ gfortran testpublic.f90
rimu[~]$ ./a.out
 "rhubarb" is character kind = 1 len = 7
 666.0     is real      kind = 4
rimu[~]$ 
rimu[~]$ /tmp/gf/bin/gfortran -v testpublic.f90
Driving: /tmp/gf/bin/gfortran -v testpublic.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=/tmp/gf/bin/gfortran
Target: i686-pc-linux-gnu
Configured with: /tmp/gcc-4.6.2/configure --prefix=/tmp/gf
--enable-languages=c,c++,fortran --disable-libada --with-gmp=/home/harperj1
--with-mpfr-include=/home/harperj1/mpfr-3.0.0
--with-mpfr-lib=/home/harperj1/mpfr-3.0.0/.libs
--with-mpc=/home/harperj1/mpc-0.9
Thread model: posix
gcc version 4.6.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
 /tmp/gf/libexec/gcc/i686-pc-linux-gnu/4.6.2/f951 testpublic.f90 -quiet
-dumpbase testpublic.f90 -mtune=generic -march=pentiumpro -auxbase testpublic
-version -fintrinsic-modules-path finclude -o /tmp/ccTvKzZ1.s
GNU Fortran (GCC) version 4.6.2 (i686-pc-linux-gnu)
        compiled by GNU C version 4.6.2, GMP version 4.3.2, MPFR version 3.0.0,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.6.2 (i686-pc-linux-gnu)
        compiled by GNU C version 4.6.2, GMP version 4.3.2, MPFR version 3.0.0,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
testpublic.f90: In function âtestpublicâ:
testpublic.f90:37:0: internal compiler error: in transfer_expr, at
fortran/trans-io.c:2166
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

end of thread, other threads:[~2012-07-20 12:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31  1:06 [Bug fortran/52062] New: [4.6.2 regression] public generic name, specific functions of private types john.harper at vuw dot ac.nz
2012-01-31  8:13 ` [Bug fortran/52062] " kargl at gcc dot gnu.org
2012-01-31  8:23 ` kargl at gcc dot gnu.org
2012-01-31  8:43 ` [Bug fortran/52062] [4.6 " burnus at gcc dot gnu.org
2012-01-31 10:56 ` rguenth at gcc dot gnu.org
2012-01-31 22:00 ` John.Harper at msor dot vuw.ac.nz
2012-01-31 22:27 ` dominiq at lps dot ens.fr
2012-01-31 23:16 ` sgk at troutmask dot apl.washington.edu
2012-01-31 23:45 ` dominiq at lps dot ens.fr
2012-03-01 15:16 ` jakub at gcc dot gnu.org
2012-07-20 12:18 ` mikael at gcc dot gnu.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).