[Patch, Fortran] PR fortran/38887: Fix MVBITS with runtime zero-length array
Daniel Kraft
d@domob.eu
Wed Jan 21 13:08:00 GMT 2009
Hi all,
this "trivial" patch fixes PR 38887, where a call to MVBITS aborted at
runtime if the array was empty (but this not detected at runtime).
This regression was introduced by my wrong-code fix for MVBITS; prior to
it, elemental dependencies in the arguments to MVBITS were simply
ignored, leading to that wrong-code bug. Now,
gfc_conv_elemental_dependencies is called which in turn called
internal_unpack for copying the result back after the whole evaluation.
internal_unpack however aborted when its argument was empty.
I'm not completely sure why it was done that way, as the "ordinary"
unpack library function simply returns in this case; my patch changes
internal_unpack to do so, also. I believe this is the best solution and
should not hurt; my guess is that the abort() was introduced first
simply because it was (probably) not possible at that time that
internal_unpack could be called with empty arrays. Now it is, and
instead of generating runtime-check code for this and call
internal_unpack only if the array is not empty, this seems to be the
best solution. Comments on this welcome though, if someone can point me
out why the abort() was there!
I did exclude the regenerated files from the patch, hope this is ok.
Regression-testing on gnu/linux-x86-32 (but there shouldn't be any) at
the moment. Ok for trunk if no failures?
Cheers,
Daniel
--
Done: Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090121/0615d45b/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090121/0615d45b/attachment-0001.ksh>
More information about the Fortran
mailing list