]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/43015 (ICE with BIND(C) and -fbounds-check in mingw-w64 cross-compiler)
authorTobias Burnus <burnus@net-b.de>
Wed, 10 Feb 2010 16:43:22 +0000 (17:43 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 10 Feb 2010 16:43:22 +0000 (17:43 +0100)
2010-02-10  Tobias Burnus  <burnus@net-b.de>

        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  <burnus@net-b.de>

        PR fortran/43015
        * gfortran.dg/bind_c_usage_20.f90: New test.

From-SVN: r156663

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bind_c_usage_20.f90 [new file with mode: 0644]

index 0e562a8f278b4b8efd66d1cdcda5a82846b6e7ae..fc9a64101594969921ecd8470828588107a93d04 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-10  Tobias Burnus  <burnus@net-b.de>
+
+       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  <jakub@redhat.com>
 
        PR fortran/42309
index 062310af6af7c7571cb02085449330eeb1f42bbe..34e153ae77b71c1822128efe908cbab3ecda22ca 100644 (file)
@@ -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);
index 08299247a71bf772b3502fcae55c5cddc11f0568..fdb07a6115ed1001dbb72736fbe9ac025f3b70d2 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-10  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/43015
+       * gfortran.dg/bind_c_usage_20.f90: New test.
+
 2010-02-10  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..0a6fa9e
--- /dev/null
@@ -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
+