[Patch, Fortran] PR34262 - Fix MVBITS with arrays

Tobias Burnus burnus@net-b.de
Thu Nov 29 15:01:00 GMT 2007


Paul Thomas wrote:
>> Your patch is OK :-)
>>
>> However, is the attached not more elegant?
It is more elegant, but it does not work. You get an invalid value for
iname if only one argument is passed. This causes a segmentation fault
in gfortran.fortran-torture/execute/date_time_1.f90 (-> valgrind).

There are only extremely few elemental subroutines. None of the
GNU-specific intrinsic procedures and only the following in the Fortran
2003 standard (and the Fortran 2008 draft):

- MVBITS
- IEEE_GET_FLAG *
- IEEE_GET_HALTING_MODE *

* = not yet implemented in gfortran

I see two possibilities:

a) A hackish one:

    c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+  c->resolved_sym->elemental = 1;

(Though the right hand side can be implemented fancier.)


b) A patch along my patch, but with is_elemental_subroutine moved into
gfc_get_intrinsic_sub_symbol as a non-optional argument.

What do you prefer?

I attached both variants, either of which I would like to check in
together with the previously posted test case.

Tobias

PS: I build and regtested (x86-64) version (b); (a) is less tested, but
I would do so before check in.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mvbits_variant-a.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071129/b08b9b63/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mvbits_variant-b.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071129/b08b9b63/attachment-0001.ksh>


More information about the Fortran mailing list