Re: wordcopy.c segfault on external function call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 27, 2012 at 11:52 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> David Mebane <mebane@xxxxxxxxxx> writes:
>
>> The following code extest.cpp:
>>
>> extern "C" { int ilaenv_( int *ispec, const char *name, const char
>> *uplo, int *N, int *N2, int *N3, int *N4 ); }
>>
>> int main ()
>> {
>>   int ispec = 1;
>>   const char* name = 'DSYTRD';
>>   const char uplo = 'U';
>>   int N = 4;
>>   int N2 = -1;
>>   int N3 = -1;
>>   int N4 = -1;
>>   int NB;
>>
>>   NB = ilaenv_( &ispec, name, &uplo, &N, &N2, &N3, &N4 );
>>
>>   return 0;
>>
>> }
>>
>> compiled with:
>>
>> g++ -ggdb -L/.../lapack/ extest.cpp -llapack -lblas -lgfortran
>>
>> using g++ 4.4.1, when run under gdb, segfaults at the external
>> function call, giving:
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> _wordcopy_bwd_aligned (dstp=140737353957304, srcp=-130065848,
>> len=2305843009196895680) at wordcopy.c:282
>>
>> the backtrace yields:
>>
>> #0  _wordcopy_bwd_aligned (dstp=140737353957304, srcp=-130065848,
>> len=2305843009196895680) at wordcopy.c:282
>> #1  0x00007ffff709ccaa in memmove (dest=0x7fffffffd1f0, src=<value
>> optimized out>, len=18446744073575165448) at memmove.c:99
>> #2  0x000000000040f7c1 in ilaenv_ ()
>> #3  0x00007fffffffda90 in ?? ()
>> #4  0x00007fffffffdbf0 in ?? ()
>> #5  0x0000000000000002 in ?? ()
>> #6  0x00007fffffffdbf0 in ?? ()
>> #7  0x00007fffffffd25f in ?? ()
>> #8  0x00007fffffffda60 in ?? ()
>> #9  0x0000000000000000 in ?? ()
>>
>> I have only a faint idea of what wordcopy.c does, but I'm guessing
>> that the length parameter here is perhaps a bit large.  I thought I'd
>> post here in case there's a known issue with wordcopy.c.
>
> Forget wordcopy.c.  It's just a subroutine of memmove, which is a
> standard function.  The problem here is that memmove is being called
> with a very very large length.  It's impossible for us to tell you
> anything about why that is happening, because you haven't shown us the
> source code for ilaenv_, which is the function that is calling memmove.
>
> Ian

So ilaenv_ is a LAPACK routine, written and compiled with
FORTRAN, the source code for which is here:

http://www.netlib.org/lapack/explore-html/d8/d6d/_s_r_c_2ilaenv_8f_source.html

A colleague reports that he cannot replicate the problem using gcc
4.6.1.  I suppose this more or less solves the issue for me.


Thanks,
-David



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux