From 2be517627af141485812051da28eb6bf510f87b4 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 13 May 2009 00:42:45 +0200 Subject: [PATCH] re PR fortran/40110 (Bind(C): gfortran rejects the questionable but formally correct INTEGER(C_CHAR)) 2009-05-12 Tobias Burnus PR fortran/40110 * decl.c (gfc_match_kind_spec): Turn C kind error into a * warning. 2009-05-12 Tobias Burnus PR fortran/40110 * gfortran.dg/bind_c_usage_18.f90: Change dg-error into dg-warning. * gfortran.dg/c_kind_tests_2.f03: Ditto. * gfortran.dg/interop_params.f03: Ditto. From-SVN: r147452 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/decl.c | 6 +++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 | 6 +++--- gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 | 8 ++++---- gcc/testsuite/gfortran.dg/interop_params.f03 | 2 +- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7544345..2994acf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2009-05-12 Tobias Burnus + + PR fortran/40110 + * decl.c (gfc_match_kind_spec): Turn C kind error into a warning. + 2009-05-11 Steve Ellcey * resolve.c (check_host_association): Initialize tail. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index f3ff0e6..7aa550e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2000,9 +2000,9 @@ kind_expr: if (ts->f90_type != BT_UNKNOWN && ts->f90_type != ts->type && !((ts->f90_type == BT_REAL && ts->type == BT_COMPLEX) || (ts->f90_type == BT_COMPLEX && ts->type == BT_REAL))) - gfc_error_now ("C kind type parameter is for type %s but type at %L " - "is %s", gfc_basic_typename (ts->f90_type), &where, - gfc_basic_typename (ts->type)); + gfc_warning_now ("C kind type parameter is for type %s but type at %L " + "is %s", gfc_basic_typename (ts->f90_type), &where, + gfc_basic_typename (ts->type)); gfc_gobble_whitespace (); if ((c = gfc_next_ascii_char ()) != ')' diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e1a4a9..6d432cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-05-12 Tobias Burnus + + PR fortran/40110 + * gfortran.dg/bind_c_usage_18.f90: Change dg-error into dg-warning. + * gfortran.dg/c_kind_tests_2.f03: Ditto. + * gfortran.dg/interop_params.f03: Ditto. + + 2009-05-12 Jan Hubicka * gcc.dg/tree-ssa/loop-36.c: Reduce amount of iterations to 2 so unrolling diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 index 30534cc..2bce215 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 @@ -7,7 +7,7 @@ subroutine foo(x,y,z,a) bind(c) ! { dg-warning "but may not be C interoperable" use iso_c_binding implicit none integer(4) :: x - integer(c_float) :: y ! { dg-error "C kind type parameter is for type REAL" } + integer(c_float) :: y ! { dg-warning "C kind type parameter is for type REAL" } complex(c_float) :: z ! OK, c_float == c_float_complex real(c_float_complex) :: a ! OK, c_float == c_float_complex end subroutine foo @@ -16,8 +16,8 @@ use iso_c_binding implicit none integer, parameter :: it = c_int integer, parameter :: dt = c_double -complex(c_int), target :: z1 ! { dg-error "C kind type parameter is for type INTEGER" } -complex(it), target :: z2 ! { dg-error "C kind type parameter is for type INTEGER" } +complex(c_int), target :: z1 ! { dg-warning "C kind type parameter is for type INTEGER" } +complex(it), target :: z2 ! { dg-warning "C kind type parameter is for type INTEGER" } complex(c_double), target :: z3 ! OK complex(dt), target :: z4 ! OK type(c_ptr) :: ptr diff --git a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 index ced31a5..aaaee97 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 @@ -4,11 +4,11 @@ module c_kind_tests_2 integer, parameter :: myF = c_float real(myF), bind(c) :: myCFloat - integer(myF), bind(c) :: myCInt ! { dg-error "is for type REAL" } - integer(c_double), bind(c) :: myCInt2 ! { dg-error "is for type REAL" } + integer(myF), bind(c) :: myCInt ! { dg-warning "is for type REAL" } + integer(c_double), bind(c) :: myCInt2 ! { dg-warning "is for type REAL" } integer, parameter :: myI = c_int - real(myI) :: myReal ! { dg-error "is for type INTEGER" } - real(myI), bind(c) :: myCFloat2 ! { dg-error "is for type INTEGER" } + real(myI) :: myReal ! { dg-warning "is for type INTEGER" } + real(myI), bind(c) :: myCFloat2 ! { dg-warning "is for type INTEGER" } real(4), bind(c) :: myFloat ! { dg-warning "may not be a C interoperable" } end module c_kind_tests_2 diff --git a/gcc/testsuite/gfortran.dg/interop_params.f03 b/gcc/testsuite/gfortran.dg/interop_params.f03 index 96c7d5c..ea3dada 100644 --- a/gcc/testsuite/gfortran.dg/interop_params.f03 +++ b/gcc/testsuite/gfortran.dg/interop_params.f03 @@ -14,7 +14,7 @@ contains end subroutine test_0 subroutine test_1(my_f90_real) bind(c) - real(c_int), value :: my_f90_real ! { dg-error "is for type INTEGER" } + real(c_int), value :: my_f90_real ! { dg-warning "is for type INTEGER" } end subroutine test_1 subroutine test_2(my_type) bind(c) ! { dg-error "is not C interoperable" } -- 2.7.4