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

* [Bug fortran/52062] [4.6.2 regression] public generic name, specific functions of private types
  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 ` kargl at gcc dot gnu.org
  2012-01-31  8:23 ` kargl at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-01-31  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Severity|major                       |normal

--- Comment #1 from kargl at gcc dot gnu.org 2012-01-31 05:57:22 UTC ---
Thanks for the bug report.

It seems J3 (in its infinite wisdom) change accessibility of derived types.

Page xiii

Fortran 2003 contains several extensions to Fortran 95; among them are:

 (1) Derived-type enhancements: parameterized derived types (allows the
     kind, length, or shape of a derived type's components to be chosen
     when the derived type is used), mixed component accessibility (allows
     different components to have different accessibility), public entities
     of private type, improved structure constructors, and finalizers.

I haven't looked further, but this suggest that want you found is
indeed a change in F2003 in comparison of F95.


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

* [Bug fortran/52062] [4.6.2 regression] public generic name, specific functions of private types
  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
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-01-31  8:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from kargl at gcc dot gnu.org 2012-01-31 06:16:17 UTC ---
On 4.7.0, I get 

laptop:kargl[203] gfc4x -o z foo.f90 
laptop:kargl[204] ./z
 "rhubarb" is character kind = 1 len = 7
 666.0     is real      kind = 4

I get the same results with various combinations
of options.

On 4.6.3, I see

troutmask:sgk[208] gfc46 -o z -O foo.f90
foo.f90: In function 'testpublic':
foo.f90:31: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.

On 4.5.4, I get the expected result.  So, this appears
to be a bug in the 4.6 branch, that has been fixed in
trunk.  I currently do not know if this was fixed as
a side-effect of another bug fix or specifically 
addressed by a patch in trunk.  I'll need to bug hunt.


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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 ` burnus at gcc dot gnu.org
  2012-01-31 10:56 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-31  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org
   Target Milestone|---                         |4.6.3
            Summary|[4.6.2 regression] public   |[4.6 regression] public
                   |generic name, specific      |generic name, specific
                   |functions of private types  |functions of private types


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (2 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-31 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-31
      Known to work|                            |4.5.4, 4.7.0
     Ever Confirmed|0                           |1


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (3 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: John.Harper at msor dot vuw.ac.nz @ 2012-01-31 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from John.Harper at msor dot vuw.ac.nz 2012-01-31 21:26:45 UTC ---
On Tue, 31 Jan 2012, kargl at gcc dot gnu.org wrote:

> Date: Tue, 31 Jan 2012 05:57:22 +0000
> From: kargl at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: john.harper@vuw.ac.nz
> Subject: [Bug fortran/52062] [4.6.2 regression] public generic name,
>     specific functions of private types
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52062
>
> kargl at gcc dot gnu.org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |kargl at gcc dot gnu.org
>           Severity|major                       |normal
>
> --- Comment #1 from kargl at gcc dot gnu.org 2012-01-31 05:57:22 UTC ---
> Thanks for the bug report.
>
> It seems J3 (in its infinite wisdom) change accessibility of derived types.
>
> Page xiii
>
> Fortran 2003 contains several extensions to Fortran 95; among them are:
>
> (1) Derived-type enhancements: parameterized derived types (allows the
>     kind, length, or shape of a derived type's components to be chosen
>     when the derived type is used), mixed component accessibility (allows
>     different components to have different accessibility), public entities
>     of private type, improved structure constructors, and finalizers.
>
> I haven't looked further, but this suggest that want you found is
> indeed a change in F2003 in comparison of F95.
>
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.

Indeed. I expected compilers to treat the program as either bad f95 or 
good f2003, because we're still in the transition period between them
9 years after 2003. So I was happy for gfortran 4.4.4 to treat it as
good f2003 but not for 4.6.2 to crash at compile time.

IMHO the wisdom of J3 is HUGE but not INF :-)

-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5276 fax (+64)(4)463 5045


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (4 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-31 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-31 21:46:05 UTC ---
AFAICT this is fixed in 4.6.3 r182981:

[macbook] f90/bug% /opt/gcc/gcc4.6p/bin/gfortran -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc4.6p/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc/gcc4.6p/libexec/gcc/x86_64-apple-darwin10.8.0/4.6.3/lto-wrapper
Target: x86_64-apple-darwin10.8.0
Configured with: ../p6_work/configure --prefix=/opt/gcc/gcc4.6p
--enable-languages=c,c++,lto,fortran,objc,obj-c++,java --with-gmp=/opt/mp
--with-system-zlib --with-cloog=/opt/mp --enable-cloog-backend=isl --enable-lto
Thread model: posix
gcc version 4.6.3 20120107 (prerelease) [4_6-branch revision 182981] (GCC) 

[macbook] f90/bug% /opt/gcc/gcc4.6p/bin/gfortran pr52062.f90
[macbook] f90/bug% a.out 
 "rhubarb" is character kind = 1 len = 7
 666.0     is real      kind = 4

> IMHO the wisdom of J3 is HUGE but not INF :-)

Well, it would be nice if true!-(but I guess we are to live with its
shortcoming).


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (5 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2012-01-31 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2012-01-31 21:59:33 UTC ---
On Tue, Jan 31, 2012 at 09:46:05PM +0000, dominiq at lps dot ens.fr wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52062
> 
> --- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-31 21:46:05 UTC ---
> AFAICT this is fixed in 4.6.3 r182981:
> 

troutmask:sgk[226] svn log -r 182981 ChangeLog | more
------------------------------------------------------------------------
troutmask:sgk[227] pwd
/usr/home/sgk/gcc/gcc46/gcc/fortran

There appears to be no r182981 on that branch.


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (6 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-31 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-31 22:08:35 UTC ---
> There appears to be no r182981 on that branch.

Well, the last commit before r182981 on 20120107: i.e., r182978 (date stamp).


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (7 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-01 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.3                       |4.6.4

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-01 14:39:02 UTC ---
GCC 4.6.3 is being released.


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

* [Bug fortran/52062] [4.6 regression] public generic name, specific functions of private types
  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
                   ` (8 preceding siblings ...)
  2012-03-01 15:16 ` jakub at gcc dot gnu.org
@ 2012-07-20 12:18 ` mikael at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-07-20 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mikael at gcc dot gnu.org
         Resolution|                            |WORKSFORME

--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> 2012-07-20 12:18:37 UTC ---
Works with 4.6.3 and up.


^ 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).