Skip to content

Commit 3774e0e

Browse files
committed
Fix argument passing conventions in THbookFile.
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.
1 parent 0ad7fc2 commit 3774e0e

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

hist/hbook/src/THbookFile.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,7 @@ static Int_t gLastEntry = -1;
140140

141141
// As recommended in
142142
// https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html
143-
#if __GNUC__ > 7
144-
typedef size_t fortran_charlen_t;
145-
#else
146-
typedef int fortran_charlen_t;
147-
#endif
143+
using fortran_charlen_t = size_t;
148144

149145
#else
150146
# define hlimit HLIMIT

0 commit comments

Comments
 (0)