This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran]Patch for Dcmplx.
- From: Feng Wang <wf_cs at yahoo dot com>
- To: fortran <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 5 Jan 2004 10:52:50 +0800 (CST)
- Subject: [gfortran]Patch for Dcmplx.
Hi, all
This patch fixed bugs for intrinsic function dcmplx.
Testsuit changlog entry:
2004-01-05 Feng Wang <fengwang@nudt.edu.cn>
* gfortran.fortran-torture/execute/cmplx.f90: Add dcmplx test.
fortran changelog entry:
2004-01-05 Feng Wang <fengwang@nudt.edu.cn>
* intrinsic.c (add_functions): Add resolve function to dcmplx.
* intrinsic.h (gfc_resolve_dcmplx): New function prototype.
* iresolve.c (gfc_resolve_dcmplx): New function. Resolve dcmplx.
Please check it and apply. Thanks.
r~
Feng Wang
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com *** /home/wf/02/gcc/gcc/testsuite/gfortran.fortran-torture/execute/cmplx.f90 Sat Jul 26 08:27:49 2003
--- cmplx.f90 Mon Jan 5 10:29:47 2004
*************** program testcmplx
*** 18,23 ****
--- 18,29 ----
z = c
if (z .ne. (3.0, 4.0)) call abort
+ ! dcmplx intrinsic
+ x = 3
+ y = 4
+ z = dcmplx (x, y)
+ if (z .ne. (3.0, 4.0)) call abort
+
! conjucates and aimag
c = (1.0, 2.0)
c = conjg (c)
diff -c3p fortran/intrinsic.c gcc/gcc/fortran/intrinsic.c
*** fortran/intrinsic.c Mon Jan 5 09:18:15 2004
--- gcc/gcc/fortran/intrinsic.c Mon Jan 5 09:18:24 2004
*************** add_functions (void)
*** 853,859 ****
/* Making dcmplx a specific of cmplx causes cmplx to return a double
complex instead of the default complex. */
! add_sym_2 ("dcmplx", 1, 1, BT_COMPLEX, dd, gfc_check_dcmplx, gfc_simplify_dcmplx, NULL, x, BT_REAL, dd, 0, y, BT_REAL, dd, 1); /* Extension */
make_generic ("dcmplx", GFC_ISYM_CMPLX);
--- 853,859 ----
/* Making dcmplx a specific of cmplx causes cmplx to return a double
complex instead of the default complex. */
! add_sym_2 ("dcmplx", 1, 1, BT_COMPLEX, dd, gfc_check_dcmplx, gfc_simplify_dcmplx, gfc_resolve_dcmplx, x, BT_REAL, dd, 0, y, BT_REAL, dd, 1); /* Extension */
make_generic ("dcmplx", GFC_ISYM_CMPLX);
diff -c3p fortran/intrinsic.h gcc/gcc/fortran/intrinsic.h
*** fortran/intrinsic.h Mon Jan 5 09:18:15 2004
--- gcc/gcc/fortran/intrinsic.h Mon Jan 5 09:18:24 2004
*************** void gfc_resolve_btest (gfc_expr *, gfc_
*** 227,232 ****
--- 227,233 ----
void gfc_resolve_ceiling (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_char (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_cmplx (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+ void gfc_resolve_dcmplx (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_conjg (gfc_expr *, gfc_expr *);
void gfc_resolve_cos (gfc_expr *, gfc_expr *);
void gfc_resolve_cosh (gfc_expr *, gfc_expr *);
diff -c3p fortran/iresolve.c gcc/gcc/fortran/iresolve.c
*** fortran/iresolve.c Mon Jan 5 09:18:15 2004
--- gcc/gcc/fortran/iresolve.c Mon Jan 5 09:18:24 2004
*************** gfc_resolve_cmplx (gfc_expr * f, gfc_exp
*** 324,329 ****
--- 324,334 ----
gfc_type_letter (y->ts.type), y->ts.kind);
}
+ void
+ gfc_resolve_dcmplx (gfc_expr * f, gfc_expr * x, gfc_expr * y)
+ {
+ gfc_resolve_cmplx (f, x, y, gfc_int_expr (gfc_default_double_kind ()));
+ }
void
gfc_resolve_conjg (gfc_expr * f, gfc_expr * x)