summary refs log tree commit diff
path: root/sysdeps/ia64/strncpy.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ia64/strncpy.S')
-rw-r--r--sysdeps/ia64/strncpy.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/ia64/strncpy.S b/sysdeps/ia64/strncpy.S
index a285f90bfc..4fe686165b 100644
--- a/sysdeps/ia64/strncpy.S
+++ b/sysdeps/ia64/strncpy.S
@@ -63,6 +63,8 @@ ENTRY(strncpy)
 	mov	saved_pr = pr           // save the predicate registers
 	.save ar.lc, saved_lc
 	mov 	saved_lc = ar.lc	// save the loop counter
+	mov	ar.ec = 0		// ec is not guaranteed to
+					// be zero upon function entry
 	.body
 	cmp.geu p6, p5 = 24, in2
 (p6)	br.cond.spnt .short_len
@@ -221,7 +223,9 @@ ENTRY(strncpy)
 	ld8	r[MEMLAT] = [tmp]
 	br.cond.sptk .back3
 .recovery4:
+	cmp.eq	p5, p6 = len, r0
 	add	tmp = -MEMLAT * 8, src ;;
-	ld8	r[MEMLAT - 1] = [tmp]
+(p6)	ld8	r[MEMLAT - 1] = [tmp]
+(p5)	mov	r[MEMLAT - 1] = r0
 	br.cond.sptk .back4
 END(strncpy)