Skip to content

Uninitialized variable in P?TRORD #32

@swappik

Description

@swappik

There are problem with using a uninitialized variable in P?TRORD that leads to undefined behavior. I'm talking about INFODUM variable in pdtrord.f and pstrord.f.

Example from pdtrord.f:525 :

CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1, -1, -1,
     $        -1, -1 )
INFO = INFODUM( 1 )

Here we find maximum of uninitialized INFODUM from each process and put this maximum into INFO. So we ignore INFO value and replace it with some undefined value from INFODUM (that often is zero and that's why tests can be passed without warnings or errors).

You can find same problem with IERR in same file on 3256 and 3268 lines.

CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
     $           -1, -1, -1, -1 )
IERR = INFODUM( 1 )
CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
     $           -1, -1, -1, -1 )
IERR = INFODUM( 1 )

My suggestion is fix INFO distribution on 525 line (and other places) like this:

CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1,
     $           -1, -1, -1, -1 )

What do you think? If it's ok then I can make PR with those fixes.

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