[ARC]PR 88409: miscompilation due to missing cc clobber in longlong.h macros
authorVineet Gupta <vgupta@synopsys.com>
Wed, 3 Apr 2019 09:53:03 +0000 (09:53 +0000)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Wed, 3 Apr 2019 09:53:03 +0000 (11:53 +0200)
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: Claudiu Zissulescu <claziss@gmail.com>
From-SVN: r270118

include/ChangeLog
include/longlong.h

index be08141deeb9dd2ad44a5abac90a811ea0d63cd5..ffa48aef7c4bf85827c99937cfae140a6a05536f 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-03  Vineet Gupta  <vgupta@synopsys.com>
+
+       PR89877
+       * longlong.h [__arc__] (add_ssaaaa): Add cc clobber.
+       (sub_ddmmss): Likewise.
+
 2019-02-11  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * splay-tree.h (splay_tree_delete_key_fn): Update comment.
index 3dd8dc3aa80cf51d7e96efb2f8b6a0a60ab60cd3..1f0ce4204255945d2c19ba73c0a4910d10145a93 100644 (file)
@@ -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__