re PR fortran/37201 (ICE in in gfc_conv_string_parameter)
2008-08-24 Tobias Burnus <burnus@net-b.de> PR fortran/37201 * trans-expr.c (gfc_conv_function_call): Add string_length for character-returning bind(C) functions. 2008-08-24 Tobias Burnus <burnus@net-b.de> PR fortran/37201 * gfortran.dg/bind_c_usage_17.f90: New. * gfortran.dg/bind_c_usage_17_c.c: New. From-SVN: r139537
This commit is contained in:
parent
0dbca53731
commit
3a73a5409f
@ -1,3 +1,9 @@
|
||||
2008-08-24 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/37201
|
||||
* trans-expr.c (gfc_conv_function_call): Add string_length
|
||||
for character-returning bind(C) functions.
|
||||
|
||||
2008-08-24 Daniel Kraft <d@domob.eu>
|
||||
|
||||
* gfortran.h (gfc_typebound_proc): New struct.
|
||||
|
@ -2677,7 +2677,9 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
|
||||
gfc_finish_interface_mapping (&mapping, &se->pre, &se->post);
|
||||
|
||||
ts = sym->ts;
|
||||
if (ts.type == BT_CHARACTER && !sym->attr.is_bind_c)
|
||||
if (ts.type == BT_CHARACTER && sym->attr.is_bind_c)
|
||||
se->string_length = build_int_cst (gfc_charlen_type_node, 1);
|
||||
else if (ts.type == BT_CHARACTER)
|
||||
{
|
||||
if (sym->ts.cl->length == NULL)
|
||||
{
|
||||
|
@ -1,3 +1,9 @@
|
||||
2008-08-24 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/37201
|
||||
* gfortran.dg/bind_c_usage_17.f90: New.
|
||||
* gfortran.dg/bind_c_usage_17_c.c: New.
|
||||
|
||||
2008-08-24 Daniel Kraft <d@domob.eu>
|
||||
|
||||
* gfortran.dg/finalize_5.f03: Adapted expected error message to changes
|
||||
|
38
gcc/testsuite/gfortran.dg/bind_c_usage_17.f90
Normal file
38
gcc/testsuite/gfortran.dg/bind_c_usage_17.f90
Normal file
@ -0,0 +1,38 @@
|
||||
! { dg-do run }
|
||||
! { dg-additional-sources bind_c_usage_17_c.c }
|
||||
!
|
||||
! PR fortran/37201
|
||||
!
|
||||
!
|
||||
!
|
||||
MODULE mod
|
||||
INTERFACE
|
||||
FUNCTION cdir() BIND(C,name="cdir") RESULT(r)
|
||||
USE iso_c_binding
|
||||
CHARACTER(kind=C_CHAR) :: r
|
||||
END FUNCTION
|
||||
END INTERFACE
|
||||
END MODULE
|
||||
|
||||
PROGRAM test
|
||||
USE mod
|
||||
integer :: i = -43
|
||||
character(len=1) :: str1
|
||||
character(len=4) :: str4
|
||||
str1 = 'x'
|
||||
str4 = 'xyzz'
|
||||
str1 = cdir()
|
||||
if(str1 /= '/') call abort()
|
||||
str4 = cdir()
|
||||
if(str4 /= '/' .or. ichar(str4(2:2)) /= 32) call abort()
|
||||
i = ICHAR(cdir())
|
||||
if (i /= 47) call abort()
|
||||
str4 = 'xyzz'
|
||||
WRITE(str4,'(a)') cdir()
|
||||
if(str4 /= '/' .or. ichar(str4(2:2)) /= 32) call abort()
|
||||
str4 = 'xyzz'
|
||||
WRITE(str4,'(i0)') ICHAR(cdir())
|
||||
if(str4 /= '47' .or. ichar(str4(3:3)) /= 32) call abort()
|
||||
END PROGRAM
|
||||
|
||||
! { dg-final { cleanup-modules "mod" } }
|
4
gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c
Normal file
4
gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c
Normal file
@ -0,0 +1,4 @@
|
||||
/* PR fortran/37201.
|
||||
Linked with bind_c_usage_17.f90. */
|
||||
|
||||
char cdir(void){return '/';}
|
Loading…
Reference in New Issue
Block a user