public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/56082] New: FAIL: gfortran.dg/bind_c_bool_1.f90  -O   (test for errors, line 18) on powerpc-apple-darwin9 with -m32
@ 2013-01-23 13:57 dominiq at lps dot ens.fr
  2013-02-12 11:33 ` [Bug testsuite/56082] " dominiq at lps dot ens.fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-23 13:57 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: dominiq@lps.ens.fr
                CC: burnus@net-b.de, iains@gcc.gnu.org,
                    mikestump@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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-12 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 13:57 [Bug testsuite/56082] New: FAIL: gfortran.dg/bind_c_bool_1.f90 -O (test for errors, line 18) on powerpc-apple-darwin9 with -m32 dominiq at lps dot ens.fr
2013-02-12 11:33 ` [Bug testsuite/56082] " dominiq at lps dot ens.fr
2013-02-12 16:22 ` burnus at gcc dot gnu.org
2013-02-12 16:27 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).