~ubuntu-branches/ubuntu/wily/tcc/wily

« back to all changes in this revision

Viewing changes to debian/patches/0006-get_reg-try-to-free-r2-for-an-SValue-first.patch

  • Committer: Package Import Robot
  • Author(s): Thomas Preud'homme, Paul Tagliamonte, Thomas Preud'homme
  • Date: 2012-07-21 03:43:35 UTC
  • mfrom: (17.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120721034335-xxowewxahdkdlb4m
Tags: 0.9.26~git20120612.ad5f375-6
[Paul Tagliamonte]
  * Uploading Tom's fixes on his behalf. Although he's signed this upload
    (he issued a debdiff), I've prepared this upload. Fix verified on
    i386.

[Thomas Preud'homme]
  * debian/patches:
    + Fix incorrect reading of long long values on architecture with 32bits
      registers like i386 and armel (Closes: #681281).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 315185fe1db1296e511bec15894dad22432c9a7f Mon Sep 17 00:00:00 2001
 
2
From: Thomas Preud'homme <robotux@celest.fr>
 
3
Date: Sat, 21 Jul 2012 03:36:51 +0200
 
4
Subject: get_reg(): try to free r2 for an SValue first
 
5
 
 
6
To be able to load a long long value correctly on i386, gv() rely on the
 
7
fact that when get_reg() look at an SValue it tries first to free the
 
8
register in r2 and then r. More information about the context can be
 
9
found at
 
10
http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html
 
11
and later at
 
12
http://lists.nongnu.org/archive/html/tinycc-devel/2012-07/msg00021.html
 
13
 
 
14
Origin: upstream,http://repo.or.cz/w/tinycc.git/commit/d1694f7d7e6d96f64d1330c9b43491b613272b1e
 
15
Bug-Debian: http://bugs.debian.org/681281
 
16
Forwarded: http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html
 
17
Last-Updated: 2012-07-21
 
18
Applied-Upstream: commit:d1694f7d7e6d96f64d1330c9b43491b613272b1e
 
19
---
 
20
 tccgen.c |    9 +++++----
 
21
 1 file changed, 5 insertions(+), 4 deletions(-)
 
22
 
 
23
diff --git a/tccgen.c b/tccgen.c
 
24
index d27bdba..71d0809 100644
 
25
--- a/tccgen.c
 
26
+++ b/tccgen.c
 
27
@@ -589,11 +589,11 @@ ST_FUNC int get_reg(int rc)
 
28
        IMPORTANT to start from the bottom to ensure that we don't
 
29
        spill registers used in gen_opi()) */
 
30
     for(p=vstack;p<=vtop;p++) {
 
31
-        r = p->r & VT_VALMASK;
 
32
+        /* look at second register (if long long) */
 
33
+        r = p->r2 & VT_VALMASK;
 
34
         if (r < VT_CONST && (reg_classes[r] & rc))
 
35
             goto save_found;
 
36
-        /* also look at second register (if long long) */
 
37
-        r = p->r2 & VT_VALMASK;
 
38
+        r = p->r & VT_VALMASK;
 
39
         if (r < VT_CONST && (reg_classes[r] & rc)) {
 
40
         save_found:
 
41
             save_reg(r);
 
42
@@ -812,7 +812,8 @@ ST_FUNC int gv(int rc)
 
43
                     vtop[-1].r = r; /* save register value */
 
44
                     vtop->r = vtop[-1].r2;
 
45
                 }
 
46
-                /* allocate second register */
 
47
+                /* Allocate second register. Here we rely on the fact that
 
48
+                   get_reg() tries first to free r2 of an SValue. */
 
49
                 r2 = get_reg(rc2);
 
50
                 load(r2, vtop);
 
51
                 vpop();