http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56082
Bug #: 56082 Summary: FAIL: gfortran.dg/bind_c_bool_1.f90 -O (test for errors, line 18) on powerpc-apple-darwin9 with -m32 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite AssignedTo: unassig...@gcc.gnu.org ReportedBy: domi...@lps.ens.fr CC: bur...@net-b.de, ia...@gcc.gnu.org, mikest...@comcast.net Host: powerpc-apple-darwin9 Target: powerpc-apple-darwin9 Build: powerpc-apple-darwin9 The test gfortran.dg/bind_c_bool_1.f90 fails on powerpc-apple-darwin9 with -m32 (but not with -m64). From http://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#Darwin-Options -mone-byte-bool Override the defaults for `bool' so that `sizeof(bool)==1'. By default `sizeof(bool)' is `4' when compiling for Darwin/PowerPC and `1' when compiling for Darwin/x86, so this option has no effect on x86. As shown by the following test [karma] f90/bug% cat c_bool.f90 use iso_c_binding; print *, C_Bool; end [karma] f90/bug% gfc c_bool.f90 [karma] f90/bug% a.out 4 [karma] f90/bug% gfc c_bool.f90 -m64 [karma] f90/bug% a.out 1 [karma] f90/bug% C_Bool is 4 for Darwin/PowerPC (32 bit mode) and the test ! { dg-do compile } subroutine sub(x) bind(C) ! { dg-error "GNU Extension: LOGICAL dummy argument 'x' at .1. with non-C_Bool kind in BIND.C. procedure 'sub'" } logical(kind=4) :: x end subroutine sub does not give any error even with -std=f2003. I can think of at least 3 ways to fix the test: (a) XFAIL the test. --- /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/bind_c_bool_1.f90 2013-01-13 07:07:14.000000000 +0100 +++ /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_bool_1_a.f90 2013-01-23 14:44:33.000000000 +0100 @@ -16,7 +16,7 @@ end function sub4 subroutine sub(x) bind(C) ! { dg-error "GNU Extension: LOGICAL dummy argument 'x' at .1. with non-C_Bool kind in BIND.C. procedure 'sub'" } - logical(kind=4) :: x + logical(kind=2) :: x end subroutine sub subroutine sub3(y) bind(C) (b) Use logical(kind=2), hoping that there is no targer with C_Bool==2. --- /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/bind_c_bool_1.f90 2013-01-13 07:07:14.000000000 +0100 +++ /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_bool_1_b.f90 2013-01-23 14:52:45.000000000 +0100 @@ -15,7 +15,7 @@ function sub4() bind(C) result(res) ! { end function sub4 -subroutine sub(x) bind(C) ! { dg-error "GNU Extension: LOGICAL dummy argument 'x' at .1. with non-C_Bool kind in BIND.C. procedure 'sub'" } +subroutine sub(x) bind(C) ! { dg-error "GNU Extension: LOGICAL dummy argument 'x' at .1. with non-C_Bool kind in BIND.C. procedure 'sub'" "" { xfail { powerpc*-apple-darwin* && { ! lp64 } } } } logical(kind=4) :: x end subroutine sub (c) Use the following patch --- /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/bind_c_bool_1.f90 2013-01-13 07:07:14.000000000 +0100 +++ /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_bool_1.f90 2013-01-21 19:50:29.000000000 +0100 @@ -1,5 +1,6 @@ ! { dg-do compile } ! { dg-options "-std=f2003" } +! { dg-additional-options "-mone-byte-bool" { target { powerpc*-apple-darwin* && { ! lp64 } } } } ! ! PR fortran/55758 ! What is the best one? or is there a better one?