[patch, Fortran] PR61933 Inquire on Internal Units

Tobias Burnus burnus@net-b.de
Wed Jan 21 23:33:00 GMT 2015


Hi Jerry et al.,

Jerry DeLisle wrote:
> I have added the following to libgfortran.h and used them (see patch)
>
> /* Special unit numbers used to convey certain conditions. Numbers -3
>    thru -9 available.  NEWUNIT values start at -10.  */
> #define GFC_INTERNAL_UNIT -1
> #define GFC_INVALID_UNIT  -2
>

Thanks!

>>
>> The conditions could be combined with a 
>> fold_build2_loc(...,TRUTH_AND_EXPR,...).
>>
>
> I have combined the conditions using TRUTH_OR_EXPR which is what we 
> want.  I also rolled the one helper function I had into the caller 
> since I now only build one block in the combined condition.
>
>
> Regression tested completely again.  OK for Trunk?
> Thanks for the review.

Looks quite good to me. On possible modification would be for:

> +      var = build3_v (COND_EXPR, cond3, body, build_empty_stmt (input_location));

You could add before that line:
   cond3 = gfc_unlikely (cond3, PRED_FORTRAN_FAIL_IO);
which tells the compiler that it is less likely that that branch is taken.


However, I don't quite understand:

+    *iqp->exist = (u != NULL) || (iqp->common.unit >= 0 	
+		   && iqp->common.unit <= GFC_INTEGER_4_HUGE);

The "ipq->common.unit <= GFC_INTEGER_4_HUGE" is always true, isn't it? Or do I miss something?

Also, I miss the test case. I assume that you still include it, don't you?


Tobias



More information about the Fortran mailing list