This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49112] New: Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: "jwmwalrus at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 22 May 2011 16:26:53 +0000
- Subject: [Bug fortran/49112] New: Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49112
Summary: Missing type-bound procedure, "duplicate save"
warnings and internal compiler error
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jwmwalrus@gmail.com
When I compile the following module:
module datetime_mod
implicit none
private
save
type, public :: DateTime
integer :: year = 0, month = 0, day = 0, hh = 0, mm = 0, ss = 0, &
sss = 0
contains
procedure :: getString
procedure :: getDateString
procedure :: getTimeString
procedure, private :: getFormattedString
end type
type(DateTime), parameter :: & !***
ISO_REFERENCE_DATE = DateTime(1875, 5, 20, 0, 0, 0, 0), & !***
GREGORIAN_REFERENCE_DATE = DateTime(1582, 10, 15, 0, 0, 0, 0) !***
contains
function getString(dt, FMT) result(string)
character(:), allocatable :: string
class(DateTime), intent(IN) :: dt
integer, optional, intent(IN) :: FMT
continue
string = dt%getFormattedString(0, FMT)
end function
function getDateString(dt, FMT) result(string)
character(:), allocatable :: string
class(DateTime), intent(IN) :: dt
integer, optional, intent(IN) :: FMT
continue
string = dt%getFormattedString(1, FMT)
end function
function getTimeString(dt, FMT) result(string)
character(:), allocatable :: string
class(DateTime), intent(IN) :: dt
integer, optional, intent(IN) :: FMT
continue
string = dt%getFormattedString(2, FMT)
end function
elemental function getFormattedString(this, FILTER, FMT) &
result(string)
character(:), allocatable :: string
class(DateTime), intent(IN) :: this
integer, optional, intent(IN) :: FILTER, FMT
continue
string = ''
end function
end module datetime_mod
gfortran does not recognize getFormattedString as a type-bound procedure.
There are also errors related to the use of a deferred-length character as a
function result (reported as Bug 49110), and an unnecessary warning about the
duplicate save attribute. The exact output is:
...:~$ gfortran -c test_gfortran_missing_tbp.f90
test_gfortran_missing_tbp.f90:27.38:
string = dt%getFormattedString(0, FMT)
1
Error: 'getformattedstring' at (1) is not a member of the 'datetime' structure
test_gfortran_missing_tbp.f90:35.38:
string = dt%getFormattedString(1, FMT)
1
Error: 'getformattedstring' at (1) is not a member of the 'datetime' structure
test_gfortran_missing_tbp.f90:43.38:
string = dt%getFormattedString(2, FMT)
1
Error: 'getformattedstring' at (1) is not a member of the 'datetime' structure
test_gfortran_missing_tbp.f90:46.4:
elemental function getFormattedString(dt, FILTER, FMT) &
1
Error: CHARACTER(*) function 'getformattedstring' at (1) cannot be pure
test_gfortran_missing_tbp.f90:46.4:
elemental function getFormattedString(dt, FILTER, FMT) &
1
Error: CHARACTER(*) function 'getformattedstring' at (1) cannot be pure
test_gfortran_missing_tbp.f90:46.4:
elemental function getFormattedString(dt, FILTER, FMT) &
1
Error: CHARACTER(*) function 'getformattedstring' at (1) cannot be pure
test_gfortran_missing_tbp.f90:18.62:
ISO_REFERENCE_DATE = DateTime(1875, 5, 20, 0, 0, 0, 0), & !***
1
Warning: Duplicate SAVE attribute specified at (1)
test_gfortran_missing_tbp.f90:18.62:
ISO_REFERENCE_DATE = DateTime(1875, 5, 20, 0, 0, 0, 0), & !***
1
Warning: Duplicate SAVE attribute specified at (1)
If I remove the three lines marked with "!***" and also remove the ELEMENTAL
attribute from the getFormattedString function, and compile again, then I get
an internal compiler error:
...:~$ gfortran -c test_gfortran_ice.f90
test_gfortran_ice.f90:20.41:
class(DateTime), intent(IN) :: dt
1
Warning: Duplicate SAVE attribute specified at (1)
test_gfortran_ice.f90:20.41:
class(DateTime), intent(IN) :: dt
1
Warning: Duplicate SAVE attribute specified at (1)
test_gfortran_ice.f90: In function âgettimestringâ:
test_gfortran_ice.f90:41:0: internal compiler error: in fold_convert_loc, at
fold-const.c:1906
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions
The version information is:
...:~$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.6.0-3~ppa1'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 20110409 (prerelease) (Ubuntu 4.6.0-3~ppa1)
The system information (for Ubuntu 11.04) is:
...:~$ uname -srvmpio
Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64
x86_64 x86_64 GNU/Linux
- Follow-Ups:
- [Bug fortran/49112] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: jwmwalrus at gmail dot com
- [Bug fortran/49112] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: jwmwalrus at gmail dot com
- [Bug fortran/49112] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org
- [Bug fortran/49112] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: jwmwalrus at gmail dot com
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: jwmwalrus at gmail dot com
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org
- [Bug fortran/49112] [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
- From: janus at gcc dot gnu.org