Skip to content

[flang][runtime] Handle empty NAMELIST value list #151770

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

klausler
Copy link
Contributor

@klausler klausler commented Aug 1, 2025

InputNamelist() returns early if any value list read in by InputDerivedType() or DescriptorIo() is empty, since they return false. But an empty value list is okay, and the early return should occur only on error.

Fixes #151756.

Copy link
Contributor

@eugeneepshteyn eugeneepshteyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test?

Copy link
Contributor

@akuhlens akuhlens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does checking if the handler has signalled an error correspond to the empty list? It isn't obvious where there error is coming from, though I assume if I stared at the code long enough I would be able to figure it out.

@klausler
Copy link
Contributor Author

klausler commented Aug 4, 2025

How does checking if the handler has signalled an error correspond to the empty list? It isn't obvious where there error is coming from, though I assume if I stared at the code long enough I would be able to figure it out.

The original code was assuming that there must have been an error if no items had been read. But sometimes there are just no items in the input to be read, and this is not an error.

Copy link
Contributor

@akuhlens akuhlens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

InputNamelist() returns early if any value list read in by
InputDerivedType() or DescriptorIo<Input>() is empty, since
they return false.  But an empty value list is okay, and the
early return should occur only on error.

Fixes llvm#151756.
Copy link
Contributor

@DanielCChen DanielCChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
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

Successfully merging this pull request may close these issues.

[flang] NML: multiple name-value subsequences stopped reading the next item.
4 participants