From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sun, 26 Jan 2003 09:08:36 +0000 (+0000)
Subject: Plan 9 compiler can't return quads from the ?: (condop).
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6290011899f3691379a15c58fce0b459f021338;p=p5sagit%2Fp5-mst-13.2.git

Plan 9 compiler can't return quads from the ?: (condop).
(There may be more spots like this, so a Configure test
maybe in order, but this works for now.)  From Russ Cox.

p4raw-id: //depot/perl@18583
---

diff --git a/ext/PerlIO/via/via.xs b/ext/PerlIO/via/via.xs
index 524d24a..1f0ff40 100644
--- a/ext/PerlIO/via/via.xs
+++ b/ext/PerlIO/via/via.xs
@@ -346,7 +346,7 @@ PerlIOVia_binmode(pTHX_ PerlIO * f)
     return SvIV(result);
 }
 
-IV
+Off_t
 PerlIOVia_seek(pTHX_ PerlIO * f, Off_t offset, int whence)
 {
     PerlIOVia *s = PerlIOSelf(f, PerlIOVia);
@@ -356,7 +356,14 @@ PerlIOVia_seek(pTHX_ PerlIO * f, Off_t offset, int whence)
     SV *result =
 	PerlIOVia_method(aTHX_ f, MYMethod(SEEK), G_SCALAR, offsv, whsv,
 			 Nullsv);
+#if Off_t_size == 8 && defined(CONDOP_SIZE) && CONDOP_SIZE < Off_t_size
+    if (result)
+	return (Off_t) SvIV(result);
+    else
+	return (Off_t) -1;
+#else
     return (result) ? SvIV(result) : -1;
+#endif
 }
 
 Off_t
diff --git a/plan9/plan9ish.h b/plan9/plan9ish.h
index 6fb5966..3df8bf5 100644
--- a/plan9/plan9ish.h
+++ b/plan9/plan9ish.h
@@ -131,4 +131,6 @@
 /* For use by POSIX.xs */
 extern int tcsendbreak(int, int);
 
+#define CONDOP_SIZE 4 /* The Plan 9 compiler cannot return quads from ?: */
+
 #endif /* __PLAN9ISH_H__ */