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: [PATCH,fortran]: proposed fix for PR 32732


hi all,

i've attached an updated patch that appears to fix the problem below, while still working for the bind(c) case. however, i've only tested on x86 and x86_64, so further testing should be done and would be appreciated.

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

thanks.
Chris

2007-07-19 Christopher D. Rickett <crickett@lanl.gov>

	PR fortran/32732
	* trans-decl.c (generate_local_decl): Convert the TREE_TYPE for by
	value character dummy args of BIND(C) procedures.
	* trans-expr.c (gfc_conv_variable): Do not build address
	expression for BT_CHARACTER dummy args.

2007-07-19 Christopher D. Rickett <crickett@lanl.gov>

	PR fortran/32732
	* gfortran.dg/c_char_tests.f03: New test case.
	* gfortran.dg/c_char_driver.c: Driver for c_char_tests.f03.
	* gfortran.dg/c_char_tests_2.f03: New test case.
	* gfortran.dg/pr32732.f03: Ditto.
	* gfortran.dg/pr32732_2.f03: Ditto.


On Thu, 19 Jul 2007, Christopher D. Rickett wrote:


hi all,

would it be possible to apply the patch i proposed for PR 32732 for the BIND(C) case before fixing the non-bind(c) case? i don't think my patch for PR 32732 causes the problem illustrated below.

thanks.
Chris

On Wed, 18 Jul 2007, Tobias Burnus wrote:

Hi Chris, hi all,

The gcc/fortran/trans-decl.c part seems to be ok.

However, could you modify the gcc/fortran/trans-expr.c fix such that it
works also in the non BIND(C) case; VALUE is not restricted to Bind(c).

*************************************
program test
 implicit none
 character(len=13) :: chr
 chr =  'Fortran       '
 call sub1(chr)
 if(chr /= 'Fortran       ') call abort()
contains
 subroutine sub1(a)
   character(len=13), VALUE :: a
   a = trim(a)//" rules"
   call sub2(a)        ! WRONG: sub2 (&a, 13);
 end subroutine sub1
 subroutine sub2(a)
   character(len=13), VALUE :: a
   print *, a          ! PRINTS GARBAGE
   if(a /= 'Fortran rules') call abort()
 end subroutine sub2
end program test
*************************************

Do you have actually a SVN account or not yet?

Tobias

Attachment: icb_pr32732.diff
Description: Text document


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