bugGNU Octave - Bugs: bug #29515, libcruft/blas-xtra/cmatm3.f &...

 
 

bug #29515: libcruft/blas-xtra/cmatm3.f & f2c fortran calling convention bug

Submitted by:  Jaroslav Hajek <highegg>
Submitted on:  Sun 11 Apr 2010 12:31:14 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: Jaroslav Hajek <highegg>
Originator Name: Jarno RajahalmeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 11 Apr 2010 12:35:30 PM UTC, comment #1:

Fixed
http://hg.savannah.gnu.org/hgweb/octave/rev/9a5e2d13fa5a

Jaroslav Hajek <highegg>In charge of this item.
Sun 11 Apr 2010 12:31:14 PM UTC, original submission:

libcruft/blas-xtra/cmatm3.f calls blas function cdotu. If f2c calling convention is used, the function needs to be declared as complex, so that the compiler knows to pass the return value as the (implicit) first argument. If complex declaration is missing when using -ff2c, the call will cause a segmentation fault.

It seems that the cmatm3.f has a typo, as it declares:

complex cdot,one,zero
parameter (one = 1e0, zero = 0e0)
external cdotu,cgemv,cgemm

and later uses:

c(1,i) = cdotu(k,a(1,i),1,b(1,i),1)

The symbol "cdot" is not used at all.

The only place where cmatm3 is used is in dot.cc. I do not have a working octave built with -f2c calling convention, so I can't see if the unit tests fail.

I verified this with the following sample code:

program main

complex cdot,ac(1),bc(1),wc
external cdotu

ac(1) = cmplx(1e0,1e0)
bc(1) = cmplx(1e0,2e0)
wc = cdotu(1,ac,1,bc,1)
PRINT ,ac(1)bc(1),"==",wc

end

$ gfortran -ff2c main.f -lblas
$ ./a.out
Segmentation fault
$

Adding u to "cdot" on the complex declaration line will make this work.

Jaroslav Hajek <highegg>In charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by highegg (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 11 Apr 2010 12:35:41 PM UTChigheggStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1