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

« back to all changes in this revision

Viewing changes to tccgen.c

  • 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:
589
589
       IMPORTANT to start from the bottom to ensure that we don't
590
590
       spill registers used in gen_opi()) */
591
591
    for(p=vstack;p<=vtop;p++) {
592
 
        r = p->r & VT_VALMASK;
 
592
        /* look at second register (if long long) */
 
593
        r = p->r2 & VT_VALMASK;
593
594
        if (r < VT_CONST && (reg_classes[r] & rc))
594
595
            goto save_found;
595
 
        /* also look at second register (if long long) */
596
 
        r = p->r2 & VT_VALMASK;
 
596
        r = p->r & VT_VALMASK;
597
597
        if (r < VT_CONST && (reg_classes[r] & rc)) {
598
598
        save_found:
599
599
            save_reg(r);
812
812
                    vtop[-1].r = r; /* save register value */
813
813
                    vtop->r = vtop[-1].r2;
814
814
                }
815
 
                /* allocate second register */
 
815
                /* Allocate second register. Here we rely on the fact that
 
816
                   get_reg() tries first to free r2 of an SValue. */
816
817
                r2 = get_reg(rc2);
817
818
                load(r2, vtop);
818
819
                vpop();
1679
1680
            tcc_error("invalid operands for binary operation");
1680
1681
        goto std_op;
1681
1682
    } else if (op == TOK_SHR || op == TOK_SAR || op == TOK_SHL) {
1682
 
        t = (bt1 == VT_LLONG ? VT_LLONG : VT_INT) | (t1 & VT_UNSIGNED);
 
1683
        t = bt1 == VT_LLONG ? VT_LLONG : VT_INT;
 
1684
        if ((t1 & (VT_BTYPE | VT_UNSIGNED)) == (t | VT_UNSIGNED))
 
1685
          t |= VT_UNSIGNED;
1683
1686
        goto std_op;
1684
1687
    } else if (bt1 == VT_LLONG || bt2 == VT_LLONG) {
1685
1688
        /* cast to biggest op */