Skip to content

Non initialized Error code in parse() procedure #69

@victorsndvg

Description

@victorsndvg

Hi @szaghi ,

I think there is a bug (in release mode) using FLAP while parsing CLI multiple times.
If I run the code below, the second time that I call parse(error), error value is not initialized from the parse() procedure.

     type(Command_Line_Interface)  :: cli
     integer :: error
     cli%parse(error)
     ...
     cli%free() 
     ...
     cli%parse(error)
     ...
     cli%free() 

I think that there are 2 minor changes to fix this behaviour.
First, force a successful error code at the begining of the parse() procedure in this line: https://github.com/szaghi/FLAP/blob/master/src/lib/flap_command_line_interface_t.F90#L519

    if(present(error)) error = 0  ! <- New line
    if (self%is_parsed_) return
    ...

And finally, Set is_parsed_ variable to .false. in the free() procedure.

You can see this changes in my FLAP-fork in this commit : victorsndvg@a9c201a

Do you think I'm right or there is something that I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions