[Bug fortran/59547] New: Problem with using tbp specification function in multiple class procedures

2013-12-18 Thread b...@miller-mohr.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59547

Bug ID: 59547
   Summary: Problem with using tbp specification function in
multiple class procedures
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: b...@miller-mohr.de

Created attachment 31470
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31470action=edit
Error messages from gfortran 4.9.0

Hi,

this is a follow-up on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59450. The
ICE reported there got fixed (thanks). Verified this with 
GNU C version 4.9.0 20131217 (experimental).

However, there is still an issue with using a specification function in a class
procedure. When I use the function in multiple (tested with two) procedures, I
get errors on the function not being pure. However, when it is used in only one
procedure, this is not the case. The example I used is the following:

module classes

  implicit none

  type :: base_class
 integer :: member
   contains
 procedure, nopass :: get_num

 ! either of the lines below alone works, but not both together
 procedure :: get_array
 procedure :: get_array2
  end type

contains

  pure integer function get_num()
get_num = 2
  end function

  function get_array( this ) result(array)
class(base_class), intent(in) :: this
integer, dimension( this%get_num() ) :: array
  end function

  function get_array2( this ) result(array)
class(base_class), intent(in) :: this
integer, dimension( this%get_num(), this%get_num() ) :: array
  end function

end module

I get the attached errors.

Cheers
Marcus


[Bug fortran/59450] [OOP] ICE for type-bound-procedure expression in module procedure interface

2013-12-18 Thread b...@miller-mohr.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59450

--- Comment #9 from b...@miller-mohr.de ---
Hi,

verified that the ICE is gone in gcc version 4.9.0 20131217 (experimental).
Thanks a lot. However, there is still a problem. As it is no longer an ICE I
filed a new bug 59547 

Cheers
Marcus


[Bug fortran/59450] [OOP] ICE for type-bound-procedure expression in module procedure interface

2013-12-13 Thread b...@miller-mohr.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59450

--- Comment #5 from b...@miller-mohr.de ---
(In reply to janus from comment #4)
 (In reply to janus from comment #2)
  Draft patch which fixes the error (not regtested):
 
 Does regtest cleanly.

Hi,

just wanted to say thanks. Your speed is terrific :)

Cheers
Marcus


[Bug fortran/59450] New: ICE for Array Valued Function combined with Deferred Specification Function

2013-12-10 Thread b...@miller-mohr.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59450

Bug ID: 59450
   Summary: ICE for Array Valued Function combined with Deferred
Specification Function
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: b...@miller-mohr.de

Hi,

when I try to compile the code below I receive an internal compiler error. The
idea of the test case is to have a base class with a type-bound procedure
returning an array. The size of the array is determined by using a
specification function with deferred binding, i.e. it will be implemented in a
child class / extended derived type.

When I use a component of the base class instead of the specification function
the code compiles without problems.

module classes

  implicit none

  type, abstract :: base_class
 integer :: varnum
   contains
 procedure(pvf_get_num), nopass, deferred :: get_num
 procedure :: get_array
  end type base_class

  abstract interface
 pure function pvf_get_num() result(num)
   integer :: num
 end function pvf_get_num
  end interface

contains

  function get_array( this ) result(array)
class(base_class), intent(in) :: this

! compiles
! integer, dimension( this%varnum ) :: array

! crashes
integer, dimension( this%get_num() ) :: array

array = 0
array(1) = 1
  end function get_array

end module classes

In detail I obtain the following

Driving: gfortran -v --save-temps gcc-test2.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/lrz/mnt/sys.x86_64/compilers/gcc/4.8.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.2/configure --prefix=/lrz/sys/compilers/gcc/4.8.2
--enable-languages=ada,c,c++,fortran,java,go,objc,obj-c++
--with-mpfr=/lrz/sys/libraries/mpfr/3.0.0
--with-gmp=/lrz/sys/libraries/gmp/5.0.1 --with-mpc=/lrz/sys/libraries/mpc/0.9
Thread model: posix
gcc version 4.8.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/lrz/mnt/sys.x86_64/compilers/gcc/4.8.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951
gcc-test2.f90 -quiet -dumpbase gcc-test2.f90 -mtune=generic -march=x86-64
-auxbase gcc-test2 -version -fintrinsic-modules-path
/lrz/mnt/sys.x86_64/compilers/gcc/4.8.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/finclude
-o gcc-test2.s
GNU Fortran (GCC) version 4.8.2 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.8.2, GMP version 5.0.1, 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.8.2 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.8.2, GMP version 5.0.1, MPFR version 3.0.0,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: Segmentation fault
0x87f55f crash_signal
../../gcc-4.8.2/gcc/toplev.c:332
0x55971e mio_expr
../../gcc-4.8.2/gcc/fortran/module.c:3300
0x559d68 mio_array_spec
../../gcc-4.8.2/gcc/fortran/module.c:2406
0x559e8f mio_component
../../gcc-4.8.2/gcc/fortran/module.c:2596
0x55a11a mio_component_list
../../gcc-4.8.2/gcc/fortran/module.c:2624
0x55a11a mio_symbol
../../gcc-4.8.2/gcc/fortran/module.c:3816
0x55a442 write_symbol
../../gcc-4.8.2/gcc/fortran/module.c:5090
0x55a58d write_symbol0
../../gcc-4.8.2/gcc/fortran/module.c:5130
0x55a535 write_symbol0
../../gcc-4.8.2/gcc/fortran/module.c:5109
0x55a535 write_symbol0
../../gcc-4.8.2/gcc/fortran/module.c:5109
0x55a535 write_symbol0
../../gcc-4.8.2/gcc/fortran/module.c:5109
0x55caa7 write_module
../../gcc-4.8.2/gcc/fortran/module.c:5396
0x55caa7 gfc_dump_module(char const*, int)
../../gcc-4.8.2/gcc/fortran/module.c:5534
0x56844a gfc_parse_file()
../../gcc-4.8.2/gcc/fortran/parse.c:4623
0x5a3c05 gfc_be_parse_file
../../gcc-4.8.2/gcc/fortran/f95-lang.c:189
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See http://gcc.gnu.org/bugs.html for instructions.

Compiling the same source with 4.7.1 (on another system) I do not receive an
ICE, but instead get error reports that the specification functions wouldn't be
pure

Using built-in specs.
COLLECT_GCC=gfortran-4.7.1
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix /home/SOFTWARE/GCC/gcc-4.7.1
--program-suffix=-4.7.1 --enable-version-specific-runtime-libs
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.7.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-c' '-save-temps' '-mtune=generic' '-march=x86-64'
 /home/SOFTWARE/GCC/gcc-4.7.1/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/f951
gcc