MVBITS again

Daniel Kraft d@domob.eu
Thu Oct 23 20:12:00 GMT 2008


Hi Paul,

just to let you know how I do on this one, I've tried to abuse 
gfc_conv_elemental_dependencies for the MVBITS test:

   integer, dimension(10) :: ILA1 = (/1,2,3,4,5,6,7,8,9,10/)
   call mvbits (ILA1((/9,9,6,2,4,9,2,9,6,10/)), 2, 4, ILA1, 3)
   write (*,'(10(I3))') ila1
   end

with the attached patch (rather rough at the moment of course, just for 
testing).

While this now creates a temporary for the output array, the output is 
still wrong as MVBITS wants an INTENT(*INOUT*) argument and the created 
temporary does not take over the initial values on creation.  It seems 
to me like a bug in gfc_conv_elemental_dependencies, as this should 
indeed be done for INTENT(*INOUT*), shouldn't it?  So my question, do 
you think it's ok to fix this there in general or is it done the way it 
is at the moment for some reason I'm missing at the moment, so that I 
must not "fix" this behaviour?

What I'm proposing to do is to add a memcpy call there after creating 
the temporary that transfers the mirrored argument's content to the 
temporary for INOUT arguments (for OUT arguments nothing would change). 
  With this change in addition to my patch (I'd change the XXX-marked 
hack into only bypassing check_dependencies if the call is really to 
intrinsic MVBITS) I think we've got quite reasonable chances that MVBITS 
works correct with dependencies, iff called *without* parentheses in the 
first argument.  That is, I hope we can handle the special MVBITS 
exception with this.

That would then "only" leave open the ELEMENTAL-general (...) temporary 
thing.

Cheers,
Daniel

-- 
Done:  Arc-Bar-Cav-Rog-Sam-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran-Tou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch1.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081023/f50983d8/attachment.txt>


More information about the Fortran mailing list