This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Question about IAND() intrinsic result.
- From: Tobias Burnus <burnus at net-b dot de>
- To: Brooks Moses <brooks dot moses at codesourcery dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Thu, 04 Jan 2007 18:53:32 +0100
- Subject: Re: Question about IAND() intrinsic result.
- References: <459D3BDF.7040408@codesourcery.com>
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