Skip to content

v1: two host variables sharing a local name with different standard names will compile but clobber silently #774

Description

@jimmielin

Description

This is from Claude when investigating whether #772 applies to capgen-v1.

When looking at host vars imported by use ... only:, Claude found that two host variables sharing a local name with different standard names

v1 accepts this silently (exit 0, no warning) and emits a cap where the control-arg dummy shadows the use-associated host variable:

use test_host_mod, only: ncols, nthreads   ! host var, std name test_host_thread_count
...
  subroutine grp_one_run(..., nthreads, ...)
    integer, intent(in) :: nthreads         ! control arg, std name number_of_threads
    ...
    call thr_use_run(ncol=..., ni=nthreads, ...)   ! binds to the DUMMY

The scheme asked for test_host_thread_count but receives the framework's thread count. It compiles clean and runs with wrong data. I confirmed the Fortran semantics with a standalone test (dummy value 7 wins over host parameter 999), so this is a silent wrong-value bug, not a compile error.

Steps to Reproduce

commit ed284a8a4a6507f8c684839dbe2a2e2770b3a09d (HEAD, upstream/feature/capgen-v1)

see above.

Additional Context

Output

Metadata

Metadata

Assignees

Labels

bugFor issues describing bugs, or PRs fixing bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions