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] PR61933 Inquire on Internal Units


On 01/21/2015 03:33 PM, Tobias Burnus wrote:
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.


OK, I will add this.

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?

No you do not miss something.  I will fix that. (gadzooks)

It should be:

	 *iqp->exist = (u != NULL) || (iqp->common.unit >= 0)


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

Yes test case will be included.

With those corrections OK?

Jerry


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