Skip to content

fix: to_num_from_stream pointer position correction#1000

Merged
jalvesz merged 1 commit into
fortran-lang:masterfrom
jalvesz:to_num
Jun 9, 2025
Merged

fix: to_num_from_stream pointer position correction#1000
jalvesz merged 1 commit into
fortran-lang:masterfrom
jalvesz:to_num

Conversation

@jalvesz

@jalvesz jalvesz commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

This PR fixes the computation of the position in a character stream for the to_num_from_stream function to properly advance when the character is a long chain. Otherwise, negative numbers can be obtained from len(s, lind=int8) if the string is in effect larger than 127.

Comment thread src/stdlib_str2num.fypp
!----------------------------------------------
call to_num_base(s,v,p,err)
p = min( p , len(s, kind = int8) )
p = min( p , len(s) )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As p is declared as integer(int8), similar issues might still happen. Maybe also declare p as integer :: p? Or do you think it is not needed?

@jalvesz jalvesz Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is not needed as the kind is converted as an output of min. It could happen if an individual number is written on more than 127 characters. But even a quad number would fit.

@jvdp1 jvdp1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @jalvesz . LGTM. See my suggestion below.

@jalvesz jalvesz merged commit 25f94a9 into fortran-lang:master Jun 9, 2025
16 checks passed
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 9, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
@jalvesz jalvesz deleted the to_num branch June 10, 2025 09:45
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 10, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 11, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
github-actions Bot added a commit to banana-bred/stdlib that referenced this pull request Jun 12, 2025
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.

3 participants