This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/17615] New: Internal compiler error using interface procedures


When compiling the following source files:

------------------- vec3d.f90 --------------------------
! Operations on 3-dimensional vectors

module module_vec3d

  implicit none

! Public procedures
  private
  public :: cross_product, cross_product3_R4_R8

! Module constants
  integer, parameter :: SP = selected_real_kind(6)
  integer, parameter :: DP = selected_real_kind(12)
  real(SP), parameter :: TINY_SP = tiny(0.0_SP)
  real(DP), parameter :: TINY_DP = tiny(0.0_DP)

! Vector cross product interface
  INTERFACE cross_product
     MODULE PROCEDURE cross_product3_R4_R8
  END INTERFACE

CONTAINS

  FUNCTION cross_product3_R4_R8 (x,y) result (z)
    real(DP) :: z(3)
    real(SP), intent(in) :: x(3)
    real(DP), intent(in) :: y(3)
    z(1) = x(2) * y(3) - x(3) * y(2)
    z(2) = x(3) * y(1) - x(1) * y(3)
    z(3) = x(1) * y(2) - x(2) * y(1)
  END FUNCTION cross_product3_R4_R8

END MODULE module_vec3d
-----------------------------------------------------

----------------------- test.f90 --------------------
PROGRAM TEST

! using the vec3d module as a simple test
  use module_vec3d, only: cross_product

  implicit none

  ! parameters for precision control
  integer, parameter :: SP = selected_real_kind(6)
  integer, parameter :: DP = selected_real_kind(12)

  ! locals
  real(SP) :: a(3)
  real(DP) :: b(3), c(3)
  integer :: i

  a = (/ 1.0, 2.0, 3.0 /)
  b = (/ 1.0, -1.0, 2.0 /)
  
  do i = 1, 10000000
     ! do the test many times, so we see it high up in the profiler
     c = cross_product(a, b)
  end do
     
  ! print the answer
  print *, 'c = ', c(1), c(2), c(3)

END PROGRAM TEST
--------------------------------------------------

I get the following error:

> gfortran -v -save-temps -c test.f90
Reading specs from /home/mamod/amos/gcc-3.5/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/mamod/amos/gcc-3.5
--enable-threads --enable-languages=f95 --with-dwarf2
--with-gmp=/home/aeroapp/linux/gmp-4.1.2 --with-mpfr=/home/mamod/amos
Thread model: posix
gcc version 4.0.0 20040922 (experimental)
 /home/mamod/amos/gcc-3.5/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951 test.f90
-quiet -dumpbase test.f90 -mtune=pentiumpro -auxbase test -version -o test.s
GNU F95 version 4.0.0 20040922 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.0.0 20040922 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
test.f90: In function 'MAIN__':
test.f90:24: internal compiler error: in gfc_trans_arrayfunc_assign, at
fortran/trans-expr.c:2011
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

When cross_product3_R4_R8 is exported and used directly there is no problem, the
code compiles and runs correctly.

-- 
           Summary: Internal compiler error using interface procedures
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matthew dot amos at baesystems dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]