Skip to content

Incorrect calls to DLASET in TESTING/EIG/cchkhb2stg.f #429

Closed

Description

@serguei-patchkovskii

cchkhb2stg.f contains a number of calls to DLASET, in the form:

           CALL DLASET( 'Full', N, 1, ZERO, ZERO, SD, 1 )
           CALL DLASET( 'Full', N, 1, ZERO, ZERO, SE, 1 )

These calls are wrong, for three reasons:

  1. SD and SE are REAL variables of the default kind, while DLASET expects a DOUBLE PRECISION real kind. There is no guarantee that the underlying binary representation of zero is the same for both types, or how DLASET would interpret default real-kind ZERO, when it expects a DOUBLE PRECISION value.

  2. The calling routine expects SD and SE to be (N) REAL elements in size. It is quite likely that DLASET will initialize more than the expected size, corrupting something else.

  3. The LDA argument to DLASET (1) is potentially less than N, and can trigger a bounds violation in DLASET.

One might be tempted to replace the calls with:

           CALL SLASET( 'Full', N, 1, ZERO, ZERO, SD, N )
           CALL SLASET( 'Full', N, 1, ZERO, ZERO, SE, N )

... however, I have no clue whether this is what the author of the code really intended.

Activity

  1. h-vetinari commented on Aug 15, 2020

    @h-vetinari
    Contributor
  2. martin-frbg commented on Aug 15, 2020

    @martin-frbg
    Collaborator

    @h-vetinari that is entirely based on what serguei-patchkovskii suggested above (and currently just a dummy PR to test a new CI service for OpenBLAS). I try to keep an eye on Reference-LAPACK issues as OpenBLAS relies on it for most of its LAPACK but I do not want to steal credit for PRs (unless I have something substantial to add, or the original poster shows no interest in submitting a PR)

  3. serguei-patchkovskii commented on Aug 16, 2020

    @serguei-patchkovskii
    Author

    @martin-frbg If you can prepare a pull request with your version of the fix without too much work, it would be very helpful - I won't be able to allocate any time for this for a little while.

  4. added this to the LAPACK 3.9.1 milestone on Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions