Skip to content

command-line.f90: len_arg overwritten for single-dash arguments in parse_args() #99

@p-bro

Description

@p-bro

When encountering a single-dash argument, parse arguments will read in the next argument (l. 308), if it exists. This overwrites the len_arg variable that used to hold the length of the single-dash argument (which can contain multiple letters). However, the next loop (l. 314ff) is over len_arg. Dependent on whether the following argument is shorter or longer than the single-dash argument, this will either miss out on single-letter arguments or parse beyond the end off key_arg, leading to unpredictable behaviour.

The obvious fix is to introduce a second length variable, and that indeed resolves the issue.

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