From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22022 invoked by alias); 6 Dec 2009 10:52:55 -0000 Received: (qmail 21940 invoked by uid 48); 6 Dec 2009 10:52:38 -0000 Date: Sun, 06 Dec 2009 10:52:00 -0000 Message-ID: <20091206105238.21939.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/32957] C/Fortran interoperability and -fdefault-integer-8 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dominiq at lps dot ens dot fr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00593.txt.bz2 ------- Comment #3 from dominiq at lps dot ens dot fr 2009-12-06 10:52 ------- If I apply the following patch: --- c_loc_tests_2.f03 2009-11-25 18:17:45.000000000 +0100 +++ c_loc_tests_2_db_1.f03 2009-12-06 11:43:31.000000000 +0100 @@ -44,13 +44,13 @@ contains end subroutine test0 subroutine test1() bind(c) - integer, target, dimension(100) :: int_array_tar + integer(c_int), target, dimension(100) :: int_array_tar type(c_ptr) :: my_c_ptr_1 = c_null_ptr type(c_ptr) :: my_c_ptr_2 = c_null_ptr - int_array_tar = 100 + int_array_tar = 100_c_int my_c_ptr_1 = c_loc(int_array_tar) - if(test_array_address(my_c_ptr_1, 100) .ne. 1) then + if(test_array_address(my_c_ptr_1, 100_c_int) .ne. 1) then call abort() end if end subroutine test1 the test passes with -fdefault-integer-8. Note that gfc -fdefault-integer-8 c_loc_tests_2_db_1.f03 c_loc_tests_2_funcs.c gives a warning: cc1: warning: command line option "-fdefault-integer-8" is valid for Fortran but not for C Although such warning can be trapped by adding in gcc/testsuite/lib/prune.exp lines such that regsub -all "(^|\n)cc1: warning: command line option .-fwhole-file. is valid for Fortran but not for C" $text "" text it would be better to change the gfortran script to not pass gfortran options to other languages. If there is any interest in updating the interoperability tests to works with -fdefault-*-8, I can comb the testsuite. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32957