[6.28] Backport of fix for argument-passing conventions in hbook#22575
Open
hageboeck wants to merge 5 commits into
Open
[6.28] Backport of fix for argument-passing conventions in hbook#22575hageboeck wants to merge 5 commits into
hageboeck wants to merge 5 commits into
Conversation
According to the `gfortran` argument passing conventions, for any Fortran procedure, the compiler will automatically define a C prototype. This is what we use in `h2root`. Note that for procedures like `HROPEN` that takes string arguments, the signature of the C prototype will have extra arguments for the string lengths, which we also have to include in our forward declaration and usage. However, the type of these was changed with GCC 8 to size_t, so we have to also account for that as recommended in [1]. Otherwise, we get undefined behavor, which causes the `h2root` test to fail on ARM64 with GCC 14. [1] https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html (cherry picked from commit aafddfb) (cherry picked from commit f10c0ac)
Follow-up of root-project@aafddfb (cherry picked from commit 34af31c) (cherry picked from commit bcdd4fb)
When variable-length strings are passed into functions compiled by gfortran, the lengths of the strings have to be passed at the end of the argument list as size_t. When using gcc <= 7 or clang (where the __GNUC__ macro might return unpredictable values), we were putting int on the C side, which got interpreted as size_t on the fortran side. (cherry picked from commit 3a9316e) (cherry picked from commit 575fa7d)
Follow-up of root-project#20535 (cherry picked from commit 4ac2999) (cherry picked from commit 3c3717f)
When variable-length strings are passed into functions compiled by gfortran, the lengths of the strings have to be passed at the end of the argument list as size_t. When using gcc <= 7 or clang (where the __GNUC__ macro might return unpredictable values), we were putting int on the C side, which got interpreted as size_t on the fortran side. (cherry picked from commit 19fdba0) (cherry picked from commit ed8a5dd)
Test Results 5 files 5 suites 15h 31m 1s ⏱️ Results for commit 1a059e1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@dpiparo