Skip to content

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

@serguei-patchkovskii

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.

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