From: Tobias Burnus Date: Wed, 10 Feb 2010 16:43:22 +0000 (+0100) Subject: re PR fortran/43015 (ICE with BIND(C) and -fbounds-check in mingw-w64 cross-compiler) X-Git-Tag: releases/gcc-4.5.0~829 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=975d3303cc10d90d73d3e9344fe3765ca7e9efa2;p=thirdparty%2Fgcc.git re PR fortran/43015 (ICE with BIND(C) and -fbounds-check in mingw-w64 cross-compiler) 2010-02-10 Tobias Burnus PR fortran/43015 * trans-decl.c (gfc_generate_function_code): Only check actual-vs.-dummy character bounds if not bind(C). 2010-02-10 Tobias Burnus PR fortran/43015 * gfortran.dg/bind_c_usage_20.f90: New test. From-SVN: r156663 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0e562a8f278b..fc9a64101594 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-02-10 Tobias Burnus + + PR fortran/43015 + * trans-decl.c (gfc_generate_function_code): Only check + actual-vs.-dummy character bounds if not bind(C). + 2010-02-10 Jakub Jelinek PR fortran/42309 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 062310af6af7..34e153ae77b7 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1,5 +1,5 @@ /* Backend function setup - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Paul Brook @@ -4367,7 +4367,7 @@ gfc_generate_function_code (gfc_namespace * ns) /* If bounds-checking is enabled, generate code to check passed in actual arguments against the expected dummy argument attributes (e.g. string lengths). */ - if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) + if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) && !sym->attr.is_bind_c) add_argument_checking (&body, sym); tmp = gfc_trans_code (ns->code); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 08299247a71b..fdb07a6115ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-02-10 Tobias Burnus + + PR fortran/43015 + * gfortran.dg/bind_c_usage_20.f90: New test. + 2010-02-10 Jakub Jelinek PR debug/43010 diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_20.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_20.f90 new file mode 100644 index 000000000000..0a6fa9e9afd6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_20.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-fcheck=bounds" } +! +! PR fortran/43015 +! +! Contributed by Dennis Wassel +! +SUBROUTINE foo(msg) BIND(C, name = "Foo") + USE, INTRINSIC :: iso_c_binding + IMPLICIT NONE + CHARACTER (KIND=C_CHAR), INTENT (out) :: msg(*) +END SUBROUTINE foo +