------- 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

Reply via email to