lymar / hastache

Haskell implementation of Mustache template
Other
96 stars 16 forks source link

testsuite fails on big-endian architectures #36

Open clinty opened 10 years ago

clinty commented 10 years ago

Something goes wrong with nonEmptyDouble on mips, powerpc, s390x, and sparc, which are all big-endian platforms.

MIPS buildd log

co-dan commented 10 years ago

Hm, thanks for reporting this. I am not sure I will be able to reproduce this although

co-dan commented 10 years ago

It seems to be a "feature" of Data.AEq: http://hackage.haskell.org/package/ieee754-0.7.3/docs/Data-AEq.html

cjwatson commented 10 years ago

Perhaps this should be reassigned to patperry/hs-ieee754? The ieee754 test suite fails abysmally on powerpc (even when configured with -fbig_endian, which the Debian packaging currently fails to do):

IEEE:
  infinity:
    D1: [OK]
    D2: [OK]
    F1: [OK]
    F2: [OK]
  copySign:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    D6: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
    F6: [OK]
  succIEEE:
    nan D: [OK]
    neg D1: [OK]
    neg D2: [OK]
    neg D3: [OK]
    neg denorm D1: [OK]
    neg denorm D2: [OK]
    neg denrom D3: [OK]
    zero D1: [OK]
    zero D2: [OK]
    pos denorm D1: [OK]
    pos denorm D2: [OK]
    pos D1: [OK]
    pos D2: [OK]
    pos D3: [OK]
    nan F: [OK]
    neg F1: [OK]
    neg F2: [OK]
    neg F3: [OK]
    neg denorm F1: [OK]
    neg denorm F2: [OK]
    neg denrom F3: [OK]
    zero F1: [OK]
    zero F2: [OK]
    pos denorm F1: [OK]
    pos denorm F2: [OK]
    pos F1: [OK]
    pos F2: [OK]
    pos F3: [OK]
  predIEEE:
    D: [OK]
    F: [OK]
  bisectIEEE:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    D6: [OK]
    D7: [OK]
    D8: [OK]
    D9: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
    F6: [OK]
    F7: [OK]
    F8: [OK]
    F9: [OK]
  sameSignificandBits:
    exact D1: [OK]
    exact D2: [OK]
    exact D3: [OK]
    exact D4: [OK]
    fewbits D1: [Failed]
expected: 51
 but got: 52
    fewbits D2: [Failed]
expected: 52
 but got: 1076
    fewbits D3: [Failed]
expected: 51
 but got: 52
    fewbits D4: [OK]
    fewbits D5: [Failed]
expected: 52
 but got: 1076
    fewbits D6: [Failed]
expected: 51
 but got: 1076
    fewbits D7: [Failed]
expected: 3
 but got: 664
    close D1: [Failed]
expected: 5
 but got: 52
    close D2: [Failed]
expected: 2
 but got: 52
    close D3: [Failed]
expected: 2
 but got: 0
    close D4: [Failed]
expected: 1
 but got: 52
    close D5: [Failed]
expected: 1
 but got: 0
    2factors D1: [Failed]
expected: 0
 but got: 1076
    2factors D2: [Failed]
expected: 1
 but got: 0
    2factors D3: [Failed]
expected: 0
 but got: 52
    2factors D4: [Failed]
expected: 0
 but got: 52
    extreme D1: [Failed]
expected: 0
 but got: 52
    extreme D2: [Failed]
expected: 0
 but got: 52
    extreme D3: [Failed]
expected: 0
 but got: 52
    extreme D4: [Failed]
expected: 0
 but got: 52
    extreme D5: [Failed]
expected: 0
 but got: 1076
    extreme D6: [Failed]
expected: 0
 but got: 2099
    exact F1: [OK]
    exact F2: [OK]
    exact F3: [OK]
    exact F4: [OK]
    fewbits F1: [Failed]
expected: 22
 but got: 23
    fewbits F2: [Failed]
expected: 23
 but got: 151
    fewbits F3: [Failed]
expected: 22
 but got: 23
    fewbits F4: [OK]
    fewbits F5: [Failed]
expected: 23
 but got: 151
    fewbits F6: [Failed]
expected: 22
 but got: 151
    fewbits F7: [Failed]
expected: 3
 but got: 0
    close F1: [Failed]
expected: 5
 but got: 23
    close F2: [Failed]
expected: 2
 but got: 23
    close F3: [Failed]
expected: 2
 but got: 0
    close F4: [Failed]
expected: 1
 but got: 23
    close F5: [Failed]
expected: 1
 but got: 0
    2factors F1: [Failed]
expected: 0
 but got: 151
    2factors F2: [Failed]
expected: 1
 but got: 0
    2factors F3: [Failed]
expected: 0
 but got: 23
    2factors F4: [Failed]
expected: 0
 but got: 23
    extreme F1: [Failed]
expected: 0
 but got: 23
    extreme F2: [Failed]
expected: 0
 but got: 23
    extreme F3: [Failed]
expected: 0
 but got: 23
    extreme F4: [Failed]
expected: 0
 but got: 23
    extreme F5: [Failed]
expected: 0
 but got: 151
    extreme F6: [Failed]
expected: 0
 but got: 278
  maxNum:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
  minNum:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
  maxNaN:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
  minNaN:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    D4: [OK]
    D5: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]
    F4: [OK]
    F5: [OK]
  nan:
    D: [OK]
    F: [OK]
  nanWithPayload:
    D1: [OK]
    D2: [OK]
    F1: [OK]
    F2: [OK]
  nanPayload:
    D1: [OK]
    D2: [OK]
    D3: [OK]
    F1: [OK]
    F2: [OK]
    F3: [OK]

         Test Cases    Total
 Passed  126           126
 Failed  42            42
 Total   168           168
co-dan commented 10 years ago

@cjwatson Definitely. Thanks for running the test suite. Can somebody with the access to a big-endain arch report the bug to @patperry?

patperry commented 10 years ago

This might be easy to fix. I think that the line

# if BIG_ENDIAN == 1

(at https://github.com/patperry/hs-ieee754/blob/master/cbits/feqrel_source.c lines 19 and 31) need to be replaced by

    # ifdef BIG_ENDIAN

If someone can try making this change and test on a big endian machine, I'm happy to accept a patch.

juricast commented 9 years ago

If the following patch is used for building package haskell-ieee754 on Debian, resolving binary packages can be used to build package haskell-hastache without error on big-endian architectures.

--- haskell-ieee754-0.7.3.orig/cbits/feqrel_source.c
+++ haskell-ieee754-0.7.3/cbits/feqrel_source.c
@@ -16,7 +16,7 @@
 # define REAL_EXPBIAS            ((uint16_t) 0x3F00)
 # define REAL_EXPBIAS_INT32      ((uint32_t) 0x7F800000)
 # define REAL_MANTISSAMASK_INT32 ((uint32_t) 0x007FFFFF)
-# if BIG_ENDIAN == 1
+# if BYTE_ORDER == BIG_ENDIAN
 #  define REAL_EXPPOS_INT16 0
 # else
 #  define REAL_EXPPOS_INT16 1
@@ -28,7 +28,7 @@
 # define REAL_EXPBIAS            ((uint16_t) 0x3FE0)
 # define REAL_EXPBIAS_INT32      ((uint32_t) 0x7FF00000)
 # define REAL_MANTISSAMASK_INT32 ((uint32_t) 0x000FFFFF); /* for the MSB only */
-# if BIG_ENDIAN == 1
+# if BYTE_ORDER == BIG_ENDIAN
 #  define REAL_EXPPOS_INT16 0
 #  define REAL_SIGNPOS_BYTE 0
 # else

With this patch I was able to build package haskell-hastache on mips big-endian.

Regards, Jurica

nomeata commented 9 years ago

@juricast thanks for the patch. Would you mind reporting it at https://github.com/patperry/hs-ieee754/issues ?

(Edit: I see @patperry is reading this report, so it might not be strictly required.)