This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] PR fortran/23516 add IMAG support


Steve Kargl wrote:
> On Wed, Sep 21, 2005 at 10:23:46PM +0200, Tobias Schl?ter wrote:
> In intrinsic.c, you find
> 
> +   /* This provides compatibility with g77.  */
> +   add_sym_1 ("realpart", 1, 0, BT_REAL, dr, GFC_STD_GNU,
> +            gfc_check_fn_c, gfc_simplify_realpart, NULL,
> +            a, BT_COMPLEX, dr, REQUIRED);
> + 
> 
> gfc_check_fn_c is called to check that Z in REALPART(Z) is complex.
> gfc_simplify_realpart is called to do constant folding.
> Until you asked, I thought the NULL was getting mapped to 
> gfc_resolve_real via the
> 
> make_generic ("real", GFC_ISYM_REAL, GFC_STD_F77);
> 
> that collects REAL, SNGL, FLOAT, and REALPART under a generic
> name.  But, a -fdump-tree-original on imag_1.f shows
> 
> troutmask:sgk[578] more k.f.t02.original 
> MAIN__ ()
> {
>   real8 y;
>   real8 x;
>   complex8 z;
> 
>   z = __complex__ (1.0e+0, 2.0e+0);
>   y = IMAGPART_EXPR <z>;
>   y = IMAGPART_EXPR <z>;
>   x = (real8) (real4) REALPART_EXPR <z>;
> }
> 
> Note, the (real4) cast is wrong.  I'll need to look at this 
> some more.

Thanks for the explanation, I didn't know precisely that make_generic works
this way.  Too bad that this made you find a bug along the way :-/

> I'll revert this to simply print AIMAG for now.  I'll look into
> using the function used by the program, but I can't guarantee
> a fast turnaround.

Ok, thanks.

- Tobi


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