public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17615] New: Internal compiler error using interface procedures
@ 2004-09-22 16:15 matthew dot amos at baesystems dot com
  2004-09-22 18:11 ` [Bug fortran/17615] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: matthew dot amos at baesystems dot com @ 2004-09-22 16:15 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
@ 2004-09-22 18:11 ` pinskia at gcc dot gnu dot org
  2004-09-24 13:47 ` tobi at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-22 18:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-22 18:11 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-22 18:11:26
               date|                            |


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
  2004-09-22 18:11 ` [Bug fortran/17615] " pinskia at gcc dot gnu dot org
@ 2004-09-24 13:47 ` tobi at gcc dot gnu dot org
  2004-09-24 14:18 ` tobi at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-24 13:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-24 13:46 -------
The problem seems to be due to the only clause in this line:
 use module_vec3d, only: cross_product
apparently cross_product3_r4_r8 is not loaded into the main program's namespace.
Investigating further ...

-- 


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
  2004-09-22 18:11 ` [Bug fortran/17615] " pinskia at gcc dot gnu dot org
  2004-09-24 13:47 ` tobi at gcc dot gnu dot org
@ 2004-09-24 14:18 ` tobi at gcc dot gnu dot org
  2004-09-24 14:41 ` matthew dot amos at baesystems dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-24 14:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-24 14:18 -------
I take that last comment back, I had not rebuilt the compiler after removing a
modification.

I'm not sure if this bug also exposes an accepts-invalid issue: changing the
function call to cross_product3_R4_R8 lets the compiler produce a working
executable, even though cross_product3_r4_r8 should not be visible due to the
,ONLY clause, if I understand the standard correctly.

-- 


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
                   ` (2 preceding siblings ...)
  2004-09-24 14:18 ` tobi at gcc dot gnu dot org
@ 2004-09-24 14:41 ` matthew dot amos at baesystems dot com
  2004-09-24 17:07 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: matthew dot amos at baesystems dot com @ 2004-09-24 14:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From matthew dot amos at baesystems dot com  2004-09-24 14:41 -------
I think what you describe is correct: crossproduct3_R4_R8 should not be visible
in the program's namespace, but the compiler should have enough information to
choose cross_product3_R4_R8 from the argument types even though only
cross_product is used.

In my experience of other Fortran 95 compilers this is the expected behaviour,
but I was not sure if this feature is present in GCC and, if it was, whether it
acts like the C++ virtual keyword rather than statically linking.

The code posted above is an excerpt from a highly-numerical F90 code which I'm
trying to get working on an Itanium. The commercial compiler I have been given
is not up to the task, so I'm exploring other options!


-- 


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
                   ` (3 preceding siblings ...)
  2004-09-24 14:41 ` matthew dot amos at baesystems dot com
@ 2004-09-24 17:07 ` cvs-commit at gcc dot gnu dot org
  2004-09-24 17:12 ` tobi at gcc dot gnu dot org
  2004-09-24 17:32 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-24 17:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-24 17:07 -------
Subject: Bug 17615

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2004-09-24 17:06:58

Modified files:
	gcc/fortran    : ChangeLog trans-expr.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: pr17615.f90 

Log message:
	fortran/
	PR fortran/17615
	* trans-expr.c (gfc_trans_arrayfunc_assign): Look at resolved
	function to determine return type.
	
	testsuite/
	PR fortran/17615
	* gfortran.dg/pr17615.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.213&r2=1.214
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-expr.c.diff?cvsroot=gcc&r1=1.28&r2=1.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4343&r2=1.4344
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pr17615.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
                   ` (4 preceding siblings ...)
  2004-09-24 17:07 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-24 17:12 ` tobi at gcc dot gnu dot org
  2004-09-24 17:32 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-24 17:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-24 17:12 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/17615] Internal compiler error using interface procedures
  2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
                   ` (5 preceding siblings ...)
  2004-09-24 17:12 ` tobi at gcc dot gnu dot org
@ 2004-09-24 17:32 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 17:32 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-09-24 17:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-22 16:15 [Bug fortran/17615] New: Internal compiler error using interface procedures matthew dot amos at baesystems dot com
2004-09-22 18:11 ` [Bug fortran/17615] " pinskia at gcc dot gnu dot org
2004-09-24 13:47 ` tobi at gcc dot gnu dot org
2004-09-24 14:18 ` tobi at gcc dot gnu dot org
2004-09-24 14:41 ` matthew dot amos at baesystems dot com
2004-09-24 17:07 ` cvs-commit at gcc dot gnu dot org
2004-09-24 17:12 ` tobi at gcc dot gnu dot org
2004-09-24 17:32 ` pinskia at gcc dot gnu dot 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).