Fortran: Emit correct types for CHARACTER(C_CHAR), VALUE arguments
Make the front-end emit the right type for CHARACTER(C_CHAR), VALUE arguments to BIND(C) procedures. They are scalar integers of C type char, and should be emitted as such. They are not strings or arrays, and are not promoted to C int, either. gcc/fortran/ChangeLog: PR fortran/103828 * trans-decl.c (generate_local_decl): Do not call gfc_conv_scalar_char_value(), but check the type tree. * trans-expr.c (gfc_conv_scalar_char_value): Rename to conv_scalar_char_value, do not alter type tree. (gfc_conv_procedure_call): Adjust call to renamed conv_scalar_char_value() function. * trans-types.c (gfc_sym_type): Take care of CHARACTER(C_CHAR), VALUE arguments. * trans.h (gfc_conv_scalar_char_value): Remove prototype. gcc/testsuite/ChangeLog: PR fortran/103828 * gfortran.dg/c_char_tests_3.f90: New file. * gfortran.dg/c_char_tests_3_c.c: New file. * gfortran.dg/c_char_tests_4.f90: New file. * gfortran.dg/c_char_tests_5.f90: New file.
Showing
- gcc/fortran/trans-decl.c 11 additions, 6 deletionsgcc/fortran/trans-decl.c
- gcc/fortran/trans-expr.c 37 additions, 49 deletionsgcc/fortran/trans-expr.c
- gcc/fortran/trans-types.c 1 addition, 1 deletiongcc/fortran/trans-types.c
- gcc/fortran/trans.h 0 additions, 1 deletiongcc/fortran/trans.h
- gcc/testsuite/gfortran.dg/c_char_tests_3.f90 51 additions, 0 deletionsgcc/testsuite/gfortran.dg/c_char_tests_3.f90
- gcc/testsuite/gfortran.dg/c_char_tests_3_c.c 16 additions, 0 deletionsgcc/testsuite/gfortran.dg/c_char_tests_3_c.c
- gcc/testsuite/gfortran.dg/c_char_tests_4.f90 90 additions, 0 deletionsgcc/testsuite/gfortran.dg/c_char_tests_4.f90
- gcc/testsuite/gfortran.dg/c_char_tests_5.f90 49 additions, 0 deletionsgcc/testsuite/gfortran.dg/c_char_tests_5.f90
Loading
Please register or sign in to comment