Skip to content

Nonstandard forward reference to 'lk' is not allowed in the same specification part causes compilation errors #810

Closed
@sscalpone

Description

@sscalpone

Description

There's some non-standard non-portable Fortran code at line 55569 of stdlib_linalg_lapack_s.fypp.

55569            logical(lk) :: lquery, upper
55570            integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
55571                       tpos, wpos, s2pos, s1pos

Forward reference to 'lk' is not allowed in the same specification part. Some compilers will allow the use of 'lk' at line 55569 to reference the outer 'lk' and then from line 55570 onward use the 'lk' that is defined on line 55570.

Expected Behaviour

The code would compile. We see an error with XLF, NAG, and LLVM flang.

Version of stdlib

33559f5

Platform and Architecture

Linux

Additional Information

In the following subroutines, I changed the local declaration and all uses of 'lk' to 'llk' and things compiled fine.

stdlib_linalg_lapack_c.fypp:36510:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
stdlib_linalg_lapack_d.fypp:57095:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
stdlib_linalg_lapack_q.fypp:72920:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
stdlib_linalg_lapack_s.fypp:55570:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
stdlib_linalg_lapack_w.fypp:28871:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&
stdlib_linalg_lapack_z.fypp:36925:           integer(ilp) :: i, j, iinfo, lwmin, pn, pk, lk, ldt, ldw, lds2, lds1, ls2, ls1, lw, lt,&

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions