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: Question about IAND() intrinsic result.


Brooks Moses schrieb:
> According to the Fortran 95 standard, the two arguments to IAND() must
> be of the same INTEGER kind, and the result is of this kind as well.
The same is true for Fortran 2003.

> According to the current GFortran documentation, there is no
> restriction on the kinds of the arguments, and the "The return type is
> INTEGER(*) after cross-promotion of the arguments."
>
> Is there, in fact, some sort of cross-promotion of the arguments going
> on?  Where would I look in the source code to figure this out?
Well, first look at check.c:

  if (i->ts.kind != j->ts.kind)
    {
      if (gfc_notify_std (GFC_STD_GNU, "Extension: Different type kinds
at %L",
                          &i->where) == FAILURE)

and then in iresolve.c's gfc_resolve_iand

  /* If the kind of i and j are different, then g77 cross-promoted the
     kinds to the largest value.  The Fortran 95 standard requires the
     kinds to match.  */
  if (i->ts.kind != j->ts.kind)
    {
      if (i->ts.kind == gfc_kind_max (i,j))
        gfc_convert_type(j, &i->ts, 2);
      else
        gfc_convert_type(i, &j->ts, 2);
    }


Tobias


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