[gfortran] Fix PR 18565
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun Jan 23 18:15:00 GMT 2005
The problem is well described in the PR, but I'll summarize here.
The following program is valid Fortran 95.
program a
complex(8) z
z = (1.d0,1.d0)
print *, conjg(z)
end program a
Currently, gfortran will resolve conjg() to use the intrinsic
function dconjg(). The problem is that if -std=f95 is given
to gfortran, then dconjg is not included in list of intrinsic
function because it is not a specific name for the generic
function conjg().
The attached patch has changed intrinsic.c to use _conjg() as
the double complex version of conjg() for -std=f95 and it
makes dconjg() an alias of _conjg() for -std=gnu.
Now, with the attached patch and if the above program is
program a
complex(8) z
z = (1.d0,1.d0)
print *, dconjg(z)
end program a
kargl[226] gfc -o cg -std=f95 cg.f90
/var/tmp/ccDKKFVt.o(.text+0x4f): In function `MAIN__':
: undefined reference to `dconjg_'
collect2: ld returned 1 exit status
which is acceptable because neither "implicit none" nor
"intrinsic dconjg" were used. If either of these statements
are included you get error messages from gfortran.
2005-01-23 Steven G. Kargl <kargls@comcast.net>
PR 18565
* intrinsic.c (add_function): Change dconjg to _conjg and mark
with GFC_STD_F95; make dcongj an alias of _conjg marked with
GFC_STD_GNU.
--
Steve
-------------- next part --------------
Index: intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/intrinsic.c,v
retrieving revision 1.37
diff -u -b -u -r1.37 intrinsic.c
--- intrinsic.c 22 Jan 2005 22:32:06 -0000 1.37
+++ intrinsic.c 23 Jan 2005 17:52:51 -0000
@@ -1110,10 +1110,12 @@
NULL, gfc_simplify_conjg, gfc_resolve_conjg,
z, BT_COMPLEX, dz, REQUIRED);
- add_sym_1 ("dconjg", 1, 1, BT_COMPLEX, dd, GFC_STD_GNU,
+ add_sym_1 ("_conjg", 1, 1, BT_COMPLEX, dd, GFC_STD_F95,
NULL, gfc_simplify_conjg, gfc_resolve_conjg,
z, BT_COMPLEX, dd, REQUIRED);
+ make_alias("dconjg", GFC_STD_GNU);
+
make_generic ("conjg", GFC_ISYM_CONJG, GFC_STD_F77);
add_sym_1 ("cos", 1, 1, BT_REAL, dr, GFC_STD_F77,
More information about the Gcc-patches
mailing list