[PATCH] PR fortran/23516 add IMAG support

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Wed Sep 21 20:40:00 GMT 2005


Steve Kargl wrote:
> The attached updated patch also implements REALPART and IMAGPART,
> which are defined in g77.  Since this is a more ambition patch,
> can someone review it for correctness.  The Changelog for the
> test programs is above.  The new ChangeLog for the frontend is
> 
> 2005-09-16  Steven G. Kargl  <kargls@comcast.net>
> 
> 	* intrinsic.c (add_function): Add IMAG, IMAGPART, and REALPART intrinsics.
> 	* intrinsic.h: Prototype for gfc_simplify_realpart.
> 	* intrinsic.texi: Document intrinsic procedures.
> 	* simplify.c (gfc_simplify_aimag): Update error message.
> 	(gfc_simplify_realpart): New function

I see that this works and can see what it does in the output, I just can't see
how this is done in the code.  Can you point me to where REALPART is actually
evaluated?  This is all quite simple, so I'm convinced it's ok, I just
couldn't figure this out yet.

> *** 380,386 ****
>     result = gfc_constant_result (BT_REAL, e->ts.kind, &e->where);
>     mpfr_set (result->value.real, e->value.complex.i, GFC_RND_MODE);
>   
> !   return range_check (result, "AIMAG");
>   }
>   
>   
> --- 380,386 ----
>     result = gfc_constant_result (BT_REAL, e->ts.kind, &e->where);
>     mpfr_set (result->value.real, e->value.complex.i, GFC_RND_MODE);
>   
> !   return range_check (result, "AIMAG or IMAG or IMAGPART");
>   }

I understand why you would want to do this, but I'd prefer if you made this
either print only the function name the user used (e.g. by adding a second
argument to this function which gets passed the name, and then adding three
interfaces which just call this function with the correct name substituted),
or (slightly less prefered) simply only print the standard name.

- Tobi



More information about the Fortran mailing list