File unwind-ia64-2.patch of Package gcc33

From nobody Tue Apr  5 14:18:17 2005
From: James E Wilson <>
Subject: [3.3/3.4/4.0/4.1] IA-64 FP register file corruption on unwind
Date: Mon, 04 Apr 2005 21:43:10 -0700

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

This is for PR 20670, which reports a problem that turned up in Ada
code.  When installing an unwind context, the FP registers from f29 to
f31 get reloaded with the wrong values.  This was reported without a
testcase, but I managed to write a C++ one that shows the problem.

The fix is fairly simple.  There is some hand written assembly code in
the unwind-ia64.c file for restoring registers that accidentally missed
one instruction to load the address register r27 before using it to
reload f29.  This is turn causes the later FP registers to also get the
wrong value.

I consider this a serious problem with no easy workaround, and would
like to install it in as many places as possible.  Since this has always
been broken, this is not a regression, and thus does not qualify under
the normal rules for branches.  I believe I can self approve it for the
gcc-4.0 branch, but I believe I need permission for the gcc-3.4 and
gcc-3.3 branches.

This patch has been tested on ia64-linux with gcc-3.4 and gcc-4.0
bootstraps and make checks, with no regressions.  gcc-3.3 testing is in
progress, and mainline testing will follow.

I am not very familiar with the C++ testsuite, but I assume I can just
drop it into g++.dg/eh/fp-regs.C with some appropriate dg comments.  I
haven't tried to do this yet.
Jim Wilson, GNU Tools Support,

Content-Disposition: attachment; filename=patch.unwind.r27
Content-Type: text/plain; name=patch.unwind.r27; charset=UTF-8
Content-Transfer-Encoding: 7bit

2005-04-01  James E. Wilson  <>

	PR target/20670
	* unwind-ia64.c (uw_intall_context): Add missing load of r27.

Index: gcc/config/ia64/unwind-ia64.c
--- gcc/config/ia64/unwind-ia64.c.orig	2009-11-20 13:06:05.000000000 +0100
+++ gcc/config/ia64/unwind-ia64.c	2009-11-20 13:06:34.000000000 +0100
@@ -2272,6 +2272,8 @@ uw_install_context (struct _Unwind_Conte
 	"(p6) ldf.fill f22 = [r28]		\n\t"
 	" p7, p0 = r0, r29		\n\t"
 	";;					\n\t"
+	"ld8 r27 = [r20], 8			\n\t"
+	";;					\n\t"
 	"ld8 r28 = [r20], 8			\n\t"
 	"(p7) ldf.fill f23 = [r29]		\n\t"
 	" p6, p0 = r0, r22		\n\t"