This is the mail archive of the
mailing list for the GCC project.
[patch] Fix PR19294
- From: ja2morri at csclub dot uwaterloo dot ca (James Morrison)
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 16 Jan 2005 00:47:33 -0500 (EST)
- Subject: [patch] Fix PR19294
The problem here is that complex(kind=4) is only aligned to 4 bytes, but
_gfortran_transpose_8 uses an 8 byte integer which is expected to be aligned
to 8 bytes on STRICT_ALIGNMENT targets. Thus passing complex(kind=4) which
is aligned to 4 bytes and not 8 bytes causes a bus error in
_gfortran_transpose_8 which is what causes intrinsic_transpose.f90 to fail
on SPARC. This patch gets complex types to use the generic transpose function,
thus fixing the problem.
There is similar mucking of kind for complex types in gfc_resolve_reshape,
but I can't any bus errors out of any of the reshape functions. The kind
mucking is actually ignored in gfc_resolve_reshape so it might be possible
to remove that chunk of code. That is a different patch though.
The attached patch has been bootstrapped and regtested on sparc-linux, Ok
2005-01-16 James A. Morrison <firstname.lastname@example.org>
* iresolve.c (gfc_resolve_transpose): Use generic transpose
for complex numbers on STRICT_ALIGNMENT targets.
RCS file: /cvs/gcc/gcc/gcc/fortran/iresolve.c,v
retrieving revision 1.28
diff -u -p -r1.28 iresolve.c
--- iresolve.c 15 Dec 2004 03:56:05 -0000 1.28
+++ iresolve.c 15 Jan 2005 00:45:30 -0000
@@ -1,5 +1,5 @@
/* Intrinsic function resolution.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Contributed by Andy Vaught & Katherine Holcomb
@@ -31,6 +31,7 @@ Software Foundation, 59 Temple Place - S
@@ -1343,7 +1347,10 @@ gfc_resolve_transpose (gfc_expr * f, gfc
- kind = matrix->ts.kind * 2;
+ if (STRICT_ALIGNMENT)
+ kind = 0;
+ kind = matrix->ts.kind * 2;