Issue Details (XML | Word | Printable)

Key: PCC-28
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Gregory McGarry
Reporter: Gregory McGarry
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

pcc-tests/tests/c/codegen/math3.c produces wrong output on i386

Created: 06/Feb/09 07:12 AM   Updated: 08/Feb/09 11:57 PM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

Environment: OSX/i386, Ubuntu/i386


 Description  « Hide
Both platforms fail to produce the same output as gcc.

I think I recall that powerpc passes this test. (It was written for powerpc originally)

--- gcc.txt 2009-02-06 17:10:52.000000000 +1100
+++ pcc.txt 2009-02-06 17:10:46.000000000 +1100
@@ -5,12 +5,12 @@
 3: 3
 4: 4
 5: 5
- 0x1234567890abcdef -> 0xefcdab9078563412
-12
-3400
-560000
-78000000
-9000000000
-ab0000000000
-cd000000000000
-ef00000000000000
+ 0x1234567890abcdef -> 0x0
+0
+0
+0
+0
+0
+0
+0
+0



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Gregory McGarry added a comment - 06/Feb/09 07:16 AM
pcc-tests/tests/c/codegen/math2.c also fails.

Looks like the long long bitshift operators are incorrect.


Anders Magnusson added a comment - 07/Feb/09 12:12 PM
Both math2 and math3 works on *BSD, so it must be a something special in Ubuntu or OSX.

Gregory McGarry added a comment - 08/Feb/09 01:49 AM
Right. They seem to be okay on NetBSD 3.0.3.


Gregory McGarry added a comment - 08/Feb/09 11:48 PM
This does actually produce problems.

The problem may actually be in libpcc or the ABI with libpcc, since the 64-bit shift ops rely on __ashldi3 and __lshrdi3.

It's interesting that the code works with NetBSD, but the libpcc code comes from NetBSD originally.

Some unit tests for libpcc are needed.


Gregory McGarry added a comment - 08/Feb/09 11:57 PM
Problem identified in libpcc. Botched endianness test. Test now passes.