public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/vineet/arc-glibc-2.30-time_t-32-bit] gcc PR 88409: miscompilation due to missing cc clobber in longlong.h macros
@ 2020-07-16 21:51 Vineet Gupta
0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2020-07-16 21:51 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=76db6bd7913b0bd452eb0cd7fe11899abffe90ab
commit 76db6bd7913b0bd452eb0cd7fe11899abffe90ab
Author: Vineet Gupta <vgupta@synopsys.com>
Date: Thu Mar 28 15:24:35 2019 -0700
gcc PR 88409: miscompilation due to missing cc clobber in longlong.h macros
simple test such as below was failing.
| void main(int argc, char *argv[])
| {
| size_t total_time = 115424; // expected 115.424
| double secs = (double)total_time/(double)1000;
| printf("%s %d %lf\n", "secs", total_time, secs); // prints 113.504
| printf("%d\n", (size_t)secs);
| }
The printf eventually called into glibc stdlib/divrem.c:__mpn_divrem()
which uses the __arc__ specific inline asm macros from longlong.h which
were causing miscompilation.
include/
2019-03-28 Vineet Gupta <vgupta@synopsys.com>
PR 89877
* longlong.h [__arc__] (add_ssaaaa): Add cc clobber
(sub_ddmmss): Likewise.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diff:
---
stdlib/longlong.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index 3dd8dc3aa8..1f0ce42042 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -199,7 +199,8 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
: "%r" ((USItype) (ah)), \
"rICal" ((USItype) (bh)), \
"%r" ((USItype) (al)), \
- "rICal" ((USItype) (bl)))
+ "rICal" ((USItype) (bl)) \
+ : "cc")
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("sub.f %1, %4, %5\n\tsbc %0, %2, %3" \
: "=r" ((USItype) (sh)), \
@@ -207,7 +208,8 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
: "r" ((USItype) (ah)), \
"rICal" ((USItype) (bh)), \
"r" ((USItype) (al)), \
- "rICal" ((USItype) (bl)))
+ "rICal" ((USItype) (bl)) \
+ : "cc")
#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
#ifdef __ARC_NORM__
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-16 21:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 21:51 [glibc/vineet/arc-glibc-2.30-time_t-32-bit] gcc PR 88409: miscompilation due to missing cc clobber in longlong.h macros Vineet Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).