# Segfault in MKL's dgesvx

**URL:** <https://fortran-lang.discourse.group/t/segfault-in-mkls-dgesvx/238>\
**Category:** Help\
**Created:** [July 28, 2020, 1:00am UTC](https://fortran-lang.discourse.group/t/segfault-in-mkls-dgesvx/238 "2020-07-28T01:00:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtesseracted](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mtesseracted](https://fortran-lang.discourse.group/u/mtesseracted)\
**Post date:** [July 28, 2020, 1:00am UTC](https://fortran-lang.discourse.group/t/segfault-in-mkls-dgesvx/238/1 "2020-07-28T01:00:30Z")

</div>

I’m getting a segfault in the routine dgesvx using intel’s MKL. [Here](https://gist.github.com/mtesseracted/00efe9430d30106224407d270ed1d4bd) is a minimal working example. I can use dgesv, but not dgesvx which is a version that estimates the condition number of the matrix. I’m compiling with `ifort dgesvx_tester.f90 -L/opt/intel/composer2020/mkl/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread` and the output of the program segfaults at the dgesvx routine, but dgesv works. Any help would be appreciated. Sample code output:

```auto
 dgesv solution: 
     2.1213203 -0.7071068 3.0000000 4.0000000 5.0000000
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source             
a.out 000000000040594A Unknown Unknown Unknown
libpthread-2.27.s 00007FDB72F2A8A0 Unknown Unknown Unknown
libmkl_core.so 00007FDB75B4DD7A mkl_lapack_dgesvx Unknown Unknown
libmkl_intel_lp64 00007FDB74AE369D DGESVX Unknown Unknown
a.out 0000000000404292 Unknown Unknown Unknown
a.out 0000000000403002 Unknown Unknown Unknown
libc-2.27.so 00007FDB727AAB97 __libc_start_main Unknown Unknown
a.out 0000000000402EEA Unknown Unknown Unknown

```

If I compile with debugging on then it does show that the traceback to my part of the code that originates the segfault is the call to dgesvx.

---

<div class="post-metadata">

**Author:** ![lkedward](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/lkedward/32/72_2.png) [@lkedward](https://fortran-lang.discourse.group/u/lkedward)\
**Post date:** [July 28, 2020, 5:41am UTC](https://fortran-lang.discourse.group/t/segfault-in-mkls-dgesvx/238/2 "2020-07-28T05:41:25Z")

</div>

Welcome to the Discourse! I think it might be that you’ve passed a character literal (‘N’) to the EQUED argument when this is an output argument. Maybe try pass a character(1) variable there instead.

---

<div class="post-metadata">

**Author:** ![mtesseracted](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mtesseracted](https://fortran-lang.discourse.group/u/mtesseracted)\
**Post date:** [July 28, 2020, 1:29pm UTC](https://fortran-lang.discourse.group/t/segfault-in-mkls-dgesvx/238/3 "2020-07-28T13:29:55Z")

</div>

This was indeed the problem. Thank you for your reply.
