This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ISO C binding and character variables


hi Tobias,

i've attached a second attempt at this patch that should fix the bug illustrated below (it has been added as a test case). the updated patch now changes by-value character dummies to not expect an address expression.

bootstrapped and regtested on x86 and x86_64 linux with no new failures.

Chris

On Mon, 16 Jul 2007, Tobias Burnus wrote:

Hi Chris,

Christopher D. Rickett wrote:
it should provide different output for -fdump-tree-original for having
the patch applied and not having it applied (at least it does on my
boxes).
Ok, it does but only for:

c_char_tests.f03
-  if (my_char[1]{lb: 1 sz: 1} != 121)
+  if (my_char != 121)
    {
      _gfortran_abort ();
    }
-  if (my_char_2[1]{lb: 1 sz: 1} != 122)
+  if (my_char_2 != 122)

I would expect:
 call test('a')
to be converted into
 test('a')
or
 test(*"a")
but in the dump I see:
 test ("a", 1);

That is goes wrong can be seen in the following program; I get "a=_"
instead of the expected "a=a".

Tobias


module c_char_tests use, intrinsic :: iso_c_binding, only: c_char implicit none contains subroutine test(a) bind(c) character(kind=c_char), value :: a call test2(a) end subroutine test subroutine test2(a) bind(c) character(kind=c_char), value :: a print *, 'a=',a end subroutine test2 end module

program main
 use c_char_tests
 implicit none
 call test('a')
end program main

Attachment: icb.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]