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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-09-03
     Ever Confirmed|0                           |1

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-09-03 
15:01:31 UTC ---
> What about -freal-4-real-10 -freal-4-real-16 -freal-4-real-8
> -freal-8-real-10 -freal-8-real-16 and -freal-8-real-4?  See
> my initial response. ...

I have made the following change to the original test

program test
implicit none
integer, parameter :: n = 100
real(8), dimension(n,n) :: A
A = 1.1_8
A = matmul(A,A)
print *, A(1,1), A(n,n)
end program test

(n is chosen larger than the blas-matmul-limit, 30 IIRC). So I got

[macbook] f90/bug% gfc -fexternal-blas pr54463_db.f90
Undefined symbols:
  "_dgemm_", referenced from:
      _MAIN__ in ccj9WebD.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
[macbook] f90/bug% gfc -fexternal-blas -freal-8-real-4 pr54463_db.f90
Undefined symbols:
  "_sgemm_", referenced from:
      _MAIN__ in ccvXhCex.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
[macbook] f90/bug% gfc -fexternal-blas pr54463_db.f90 -L/sw64/lib -lptlapack
-lptcblas -lptf77blas -latlas
[macbook] f90/bug% a.out
   121.00000000000006        120.99999999999974     
[macbook] f90/bug% gfc -fexternal-blas -freal-8-real-4 pr54463_db.f90
-L/sw64/lib -lptlapack -lptcblas -lptf77blas -latlas
[macbook] f90/bug% a.out
   121.000000       120.999924    

i.e., -freal-8-real-4 seems to work as expected.

Then I changed pr54463_db.f90 to pr54463_db_1.f90 by replacing real(8) with
real, and I got

macbook] f90/bug% gfc -fexternal-blas pr54463_db_1.f90
Undefined symbols:
  "_sgemm_", referenced from:
      _MAIN__ in ccznZgF3.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
[macbook] f90/bug% gfc -fexternal-blas -freal-4-real-8 pr54463_db_1.f90
Undefined symbols:
  "_sgemm_", referenced from:
      _MAIN__ in ccN7UdCe.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
[macbook] f90/bug% gfc -fexternal-blas -freal-4-real-8 pr54463_db_1.f90
-L/sw64/lib -lptlapack -lptcblas -lptf77blas -latlas
[macbook] f90/bug% a.out
   0.0000000000000000        0.0000000000000000     
[macbook] f90/bug% gfc -fexternal-blas pr54463_db_1.f90 -L/sw64/lib -lptlapack
-lptcblas -lptf77blas -latlas
[macbook] f90/bug% a.out
   121.000000       120.999924    

i.e., -freal-4-real-8, as well as -fdefault-real-8, -freal-4-real-10,
-freal-4-real-16, and -freal-8-real-16, are not working as I'ld expect.

IMO there are four ways to handle this PR:

(1) the Steve's way: closing it as WONTFIX, but I ready to bet a meal in a good
restaurant in Paris next time that sooner or later another PR will be filled;

(2) add to the manual for -fexternal-blas something along the line: "Presently
the -fexternal-blas option is incompatible with the -f*-real-* ones"; this
could be effective if the knowledge of -fexternal-blas propagates through RTFM,
but not if it propagates through mailing lists;

(3) gives an error if -fexternal-blas is used with one of the -f*-real-*
options; IIRC some conbinations of options already give such errors, so either
there is a general way to do it or some code could be borrowed;

(4) since the combination '-fexternal-blas -freal-8-real-4' seems to work, 
some day, someone can try to figure out why and why the other ones are not and
provide a proper fix.

(2) is very easy, but I think (4) would be better (with a low priority).

Reply via email to