Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non initialized Error code in parse() procedure #69

Closed
victorsndvg opened this issue Oct 3, 2016 · 3 comments
Closed

Non initialized Error code in parse() procedure #69

victorsndvg opened this issue Oct 3, 2016 · 3 comments

Comments

@victorsndvg
Copy link

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?

@szaghi
Copy link
Owner

szaghi commented Oct 3, 2016

Great @victorsndvg , I'll look into it now!

@szaghi
Copy link
Owner

szaghi commented Oct 3, 2016

@victorsndvg You are right! Just patched! Thank you very much. New master will be uploaded soon.

P.S. I think this is the first test of %free method... I have to expand the tests suite...

@szaghi szaghi closed this as completed Oct 3, 2016
@szaghi
Copy link
Owner

szaghi commented Oct 3, 2016

@victorsndvg New v1.1.1 pushed. I think your patch is perfect, no other missing issues should be involved, many many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants