LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1086 - CBE doesn't handle signlessness right
Summary: CBE doesn't handle signlessness right
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: C (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2007-01-06 16:03 PST by Chris Lattner
Modified: 2010-02-22 12:47 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2007-01-06 16:03:47 PST
Consider:

int test(unsigned short X, short Y) { return X+Y; }

$ llvm-gcc t.c -c -emit-llvm -o - -O3 | llc -march=c
signed int test(signed short ltmp_0_1, signed short ltmp_1_1) {
  return ((((signed int )(signed short )ltmp_1_1)) + (((unsigned int )(unsigned short )ltmp_0_1)));
}

The first argument should be unsigned.  This is a serious bug, because it means that bugpoint will get 
confused more often than it currently does.

-Chris
Comment 1 Reid Spencer 2007-01-06 21:27:11 PST
Fixed. No llvm-commits email so no patch :(

Reid.
Comment 2 Reid Spencer 2007-01-07 01:31:56 PST
Here's the patch that fixes this:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070101/042173.html