Skip to content

Commit c87d8c6

Browse files
committed
Add an comment to explain the nrm2 workaround on OSX
1 parent 1eb79e7 commit c87d8c6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tests/correctness/blas-lapack.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,8 @@ int izamax( int n, doublecomplex *x, int incx)
849849
float snrm2( int n, float *x, int incx)
850850
{
851851
#ifdef __APPLE__
852+
//On OSX passing negative values for incx can lead to a
853+
//a crash, so we catch it here (cf. Github issue #37).
852854
if (n < 1 || incx < 1) {
853855
return 0;
854856
}
@@ -861,6 +863,8 @@ float snrm2( int n, float *x, int incx)
861863
double dnrm2( int n, double *x, int incx)
862864
{
863865
#ifdef __APPLE__
866+
//On OSX passing negative values for incx can lead to a
867+
//a crash, so we catch it here (cf. Github issue #37).
864868
if (n < 1 || incx < 1) {
865869
return 0;
866870
}
@@ -873,6 +877,8 @@ double dnrm2( int n, double *x, int incx)
873877
float scnrm2( int n, complex *x, int incx)
874878
{
875879
#ifdef __APPLE__
880+
//On OSX passing negative values for incx can lead to a
881+
//a crash, so we catch it here (cf. Github issue #37).
876882
if (n < 1 || incx < 1) {
877883
return 0;
878884
}
@@ -885,6 +891,8 @@ float scnrm2( int n, complex *x, int incx)
885891
double dznrm2( int n, doublecomplex *x, int incx)
886892
{
887893
#ifdef __APPLE__
894+
//On OSX passing negative values for incx can lead to a
895+
//a crash, so we catch it here (cf. Github issue #37).
888896
if (n < 1 || incx < 1) {
889897
return 0;
890898
}

0 commit comments

Comments
 (0)