Skip to content

Index out of bounds error in MB04DD, line 327 #21

@mccullerlp

Description

@mccullerlp

I've been using Slycot wrappers with slicot compiled using -fcheck=all to debug some occasional issues, and the wrapper itself.

As soon as bounds checking was enabled I was getting MB04DD flagged with an index out of bounds error. It was being called from the Linf norm AB13DD.

            DO 170 I = ILO, N
C
C              Compute 1-norm of row and column I without diagonal
C              elements.
C
               R = DASUM( I-ILO, A(I,ILO), LDA ) +
     $             DASUM( N-I,   A(I,I+1), LDA ) +
     $             DASUM( I-ILO, QG(ILO,I+1), 1 ) +
     $             DASUM( N-I,   QG(I,I+2), LDQG )
               C = DASUM( I-ILO, A(ILO,I), 1 ) +
     $             DASUM( N-I,   A(I+1,I), 1 ) +
     $             DASUM( I-ILO, QG(I,ILO), LDQG ) +
     $             DASUM( N-I,   QG(I+1,I), 1 )
               QII = ABS( QG(I,I) )
               GII = ABS( QG(I,I+1) )
C
...

You can see in the above that there are many references to I+1 indices. The fix is to make the loop range from 1=ILO,N-1. This seems to fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions