Skip to content

Macos: ansi-tests fail with FLOATING-POINT-INVALID-OPERATION for numerical calculations since commit 9cf6e774 (merge Merge branch 'fpe-without-sigfpe' into 'develop')

Describe the problem here.

(in-package :cl-user)

(eval-when (:compile-toplevel :load-toplevel :execute)
  (declaim (optimize (safety 3)(space 0)(speed 0)(debug 3))))

(defun test ()
  (let ((numbers
         (list 0 2305843009213693946 2305843009213693947 2305843009213693948
               2305843009213693949 2305843009213693950 2305843009213693953
               2305843009213693954 2305843009213693955 2305843009213693956
               -2305843009213693957 -2305843009213693956 -2305843009213693955
               -2305843009213693954 -2305843009213693953 -2305843009213693950
               -2305843009213693949 -2305843009213693948 -2305843009213693947 2 4 8 16 32 64
               128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576
               2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456
               536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368
               68719476736 137438953472 274877906944 549755813888 1099511627776 2199023255552
               4398046511104 8796093022208 17592186044416 35184372088832 70368744177664
               140737488355328 281474976710656 562949953421312 1125899906842624
               2251799813685248 4503599627370496 9007199254740992 18014398509481984
               36028797018963968 72057594037927936 144115188075855872 288230376151711744
               576460752303423488 1152921504606846976 2305843009213693952 4611686018427387904
               9223372036854775808 18446744073709551616 1 3 7 15 31 63 127 255 511 1023 2047
               4095 8191 16383 32767 65535 131071 262143 524287 1048575 2097151 4194303
               8388607 16777215 33554431 67108863 134217727 268435455 536870911 1073741823
               2147483647 4294967295 8589934591 17179869183 34359738367 68719476735
               137438953471 274877906943 549755813887 1099511627775 2199023255551
               4398046511103 8796093022207 17592186044415 35184372088831 70368744177663
               140737488355327 281474976710655 562949953421311 1125899906842623
               2251799813685247 4503599627370495 9007199254740991 18014398509481983
               36028797018963967 72057594037927935 144115188075855871 288230376151711743
               576460752303423487 1152921504606846975 2305843009213693951 4611686018427387903
               9223372036854775807 18446744073709551615 -2 -4 -8 -16 -32 -64 -128 -256 -512
               -1024 -2048 -4096 -8192 -16384 -32768 -65536 -131072 -262144 -524288 -1048576
               -2097152 -4194304 -8388608 -16777216 -33554432 -67108864 -134217728 -268435456
               -536870912 -1073741824 -2147483648 -4294967296 -8589934592 -17179869184
               -34359738368 -68719476736 -137438953472 -274877906944 -549755813888
               -1099511627776 -2199023255552 -4398046511104 -8796093022208 -17592186044416
               -35184372088832 -70368744177664 -140737488355328 -281474976710656
               -562949953421312 -1125899906842624 -2251799813685248 -4503599627370496
               -9007199254740992 -18014398509481984 -36028797018963968 -72057594037927936
               -144115188075855872 -288230376151711744 -576460752303423488
               -1152921504606846976 -2305843009213693952 -4611686018427387904
               -9223372036854775808 -18446744073709551616 -1 -3 -7 -15 -31 -63 -127 -255 -511
               -1023 -2047 -4095 -8191 -16383 -32767 -65535 -131071 -262143 -524287 -1048575
               -2097151 -4194303 -8388607 -16777215 -33554431 -67108863 -134217727 -268435455
               -536870911 -1073741823 -2147483647 -4294967295 -8589934591 -17179869183
               -34359738367 -68719476735 -137438953471 -274877906943 -549755813887
               -1099511627775 -2199023255551 -4398046511103 -8796093022207 -17592186044415
               -35184372088831 -70368744177663 -140737488355327 -281474976710655
               -562949953421311 -1125899906842623 -2251799813685247 -4503599627370495
               -9007199254740991 -18014398509481983 -36028797018963967 -72057594037927935
               -144115188075855871 -288230376151711743 -576460752303423487
               -1152921504606846975 -2305843009213693951 -4611686018427387903
               -9223372036854775807 -18446744073709551615
               33300140732146818380750772381422989832214186835186851059977249 12387131
               1272314 231 -131 -561823 23713 -1234611312123 444121 991
               3.1415926535897932385l0 3.4028235e38 1.4012985e-45 1.1754944e-38
               1.7976931348623157d308 4.940656458412465d-324 2.2250738585072014d-308
               1.189731495357231765l4932 3.6451995318824746025l-4951
               3.3621031431120935063l-4932 3.4028235e38 1.4012985e-45 1.1754944e-38
               -3.4028235e38 -1.4012985e-45 -1.1754944e-38 -3.4028235e38 -1.4012985e-45
               -1.1754944e-38 -1.7976931348623157d308 -4.940656458412465d-324
               -2.2250738585072014d-308 -1.189731495357231765l4932
               -3.6451995318824746025l-4951 -3.3621031431120935063l-4932 5.960465e-8
               2.9802326e-8 5.960465e-8 2.9802326e-8 1.1102230246251568d-16
               5.551115123125784d-17 5.4210108624275221706l-20 2.7105054312137610853l-20 0.0
               1.0 -1.0 313123.13 283143.22 -314781.9 131.283d0 8.3413812d-43 8.131238e20
               -46189.26 -3.7818132e7 8.131823e-18 1312.73 0.001236112 6124.124l0 1.31231l-19
               1/3 1/1000 1/1000000000000000 -10/3 -1000/7 -987129387912381/13612986912361
               189729874978126783786123/1234678123487612347896123467851234671234 #C(0.0 0.0)
               #C(1.0 0.0) #C(0.0 1.0) #C(1.0 1.0) #C(-1.0 -1.0) #C(1289713.1 -9.126813)
               #C(1.d100 1.d100) #C(-1.d-100 -1.d-100) #C(10.0 20.0) #C(100.0l0 200.0l0)
               #C(1.0 2.0) #C(1.0d0 3.0d0) #C(1.0l0 4.0l0) #C(1.0d0 5.0d0) #C(1.0l0 6.0l0)
               #C(1.0l0 7.0l0) #C(1.0 2.0) #C(1.0d0 3.0d0) #C(1.0l0 4.0l0) #C(1.0d0 5.0d0)
               #C(1.0l0 6.0l0) #C(1.0l0 7.0l0) #C(1/2 1/3))))
    (loop for x in (list 0)
       append
         (loop for y in numbers
            unless (or 
                    (progn (pprint `(,x ,y)) nil)
                    (if (= x y) (= y x) (not (= y x))))
            collect (list x y)))))

Describe expected result and what provide the output you got.

e.g.
> (load (compile-file "/Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.lisp"))

;;; Loading #P"/usr/local/lib/ecl-16.1.3/cmp.fas"
;;;
;;; Compiling /Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; End of Pass 1.
;;; Finished compiling /Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.lisp.
;;;
;;; Loading "/Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.fas"
#P"/Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.fas"
> (test)

(0 0)
(0 2305843009213693946)
(0 2305843009213693947)
(0 2305843009213693948)
(0 2305843009213693949)
(0 2305843009213693950)
(0 2305843009213693953)
(0 2305843009213693954)
(0 2305843009213693955)
(0 2305843009213693956)
(0 -2305843009213693957)
(0 -2305843009213693956)
(0 -2305843009213693955)
(0 -2305843009213693954)
(0 -2305843009213693953)
(0 -2305843009213693950)
(0 -2305843009213693949)
(0 -2305843009213693948)
(0 -2305843009213693947)
(0 2)
(0 4)
(0 8)
(0 16)
(0 32)
(0 64)
(0 128)
(0 256)
(0 512)
(0 1024)
(0 2048)
(0 4096)
(0 8192)
(0 16384)
(0 32768)
(0 65536)
(0 131072)
(0 262144)
(0 524288)
(0 1048576)
(0 2097152)
(0 4194304)
(0 8388608)
(0 16777216)
(0 33554432)
(0 67108864)
(0 134217728)
(0 268435456)
(0 536870912)
(0 1073741824)
(0 2147483648)
(0 4294967296)
(0 8589934592)
(0 17179869184)
(0 34359738368)
(0 68719476736)
(0 137438953472)
(0 274877906944)
(0 549755813888)
(0 1099511627776)
(0 2199023255552)
(0 4398046511104)
(0 8796093022208)
(0 17592186044416)
(0 35184372088832)
(0 70368744177664)
(0 140737488355328)
(0 281474976710656)
(0 562949953421312)
(0 1125899906842624)
(0 2251799813685248)
(0 4503599627370496)
(0 9007199254740992)
(0 18014398509481984)
(0 36028797018963968)
(0 72057594037927936)
(0 144115188075855872)
(0 288230376151711744)
(0 576460752303423488)
(0 1152921504606846976)
(0 2305843009213693952)
(0 4611686018427387904)
(0 9223372036854775808)
(0 18446744073709551616)
(0 1)
(0 3)
(0 7)
(0 15)
(0 31)
(0 63)
(0 127)
(0 255)
(0 511)
(0 1023)
(0 2047)
(0 4095)
(0 8191)
(0 16383)
(0 32767)
(0 65535)
(0 131071)
(0 262143)
(0 524287)
(0 1048575)
(0 2097151)
(0 4194303)
(0 8388607)
(0 16777215)
(0 33554431)
(0 67108863)
(0 134217727)
(0 268435455)
(0 536870911)
(0 1073741823)
(0 2147483647)
(0 4294967295)
(0 8589934591)
(0 17179869183)
(0 34359738367)
(0 68719476735)
(0 137438953471)
(0 274877906943)
(0 549755813887)
(0 1099511627775)
(0 2199023255551)
(0 4398046511103)
(0 8796093022207)
(0 17592186044415)
(0 35184372088831)
(0 70368744177663)
(0 140737488355327)
(0 281474976710655)
(0 562949953421311)
(0 1125899906842623)
(0 2251799813685247)
(0 4503599627370495)
(0 9007199254740991)
(0 18014398509481983)
(0 36028797018963967)
(0 72057594037927935)
(0 144115188075855871)
(0 288230376151711743)
(0 576460752303423487)
(0 1152921504606846975)
(0 2305843009213693951)
(0 4611686018427387903)
(0 9223372036854775807)
(0 18446744073709551615)
(0 -2)
(0 -4)
(0 -8)
(0 -16)
(0 -32)
(0 -64)
(0 -128)
(0 -256)
(0 -512)
(0 -1024)
(0 -2048)
(0 -4096)
(0 -8192)
(0 -16384)
(0 -32768)
(0 -65536)
(0 -131072)
(0 -262144)
(0 -524288)
(0 -1048576)
(0 -2097152)
(0 -4194304)
(0 -8388608)
(0 -16777216)
(0 -33554432)
(0 -67108864)
(0 -134217728)
(0 -268435456)
(0 -536870912)
(0 -1073741824)
(0 -2147483648)
(0 -4294967296)
(0 -8589934592)
(0 -17179869184)
(0 -34359738368)
(0 -68719476736)
(0 -137438953472)
(0 -274877906944)
(0 -549755813888)
(0 -1099511627776)
(0 -2199023255552)
(0 -4398046511104)
(0 -8796093022208)
(0 -17592186044416)
(0 -35184372088832)
(0 -70368744177664)
(0 -140737488355328)
(0 -281474976710656)
(0 -562949953421312)
(0 -1125899906842624)
(0 -2251799813685248)
(0 -4503599627370496)
(0 -9007199254740992)
(0 -18014398509481984)
(0 -36028797018963968)
(0 -72057594037927936)
(0 -144115188075855872)
(0 -288230376151711744)
(0 -576460752303423488)
(0 -1152921504606846976)
(0 -2305843009213693952)
(0 -4611686018427387904)
(0 -9223372036854775808)
(0 -18446744073709551616)
(0 -1)
(0 -3)
(0 -7)
(0 -15)
(0 -31)
(0 -63)
(0 -127)
(0 -255)
(0 -511)
(0 -1023)
(0 -2047)
(0 -4095)
(0 -8191)
(0 -16383)
(0 -32767)
(0 -65535)
(0 -131071)
(0 -262143)
(0 -524287)
(0 -1048575)
(0 -2097151)
(0 -4194303)
(0 -8388607)
(0 -16777215)
(0 -33554431)
(0 -67108863)
(0 -134217727)
(0 -268435455)
(0 -536870911)
(0 -1073741823)
(0 -2147483647)
(0 -4294967295)
(0 -8589934591)
(0 -17179869183)
(0 -34359738367)
(0 -68719476735)
(0 -137438953471)
(0 -274877906943)
(0 -549755813887)
(0 -1099511627775)
(0 -2199023255551)
(0 -4398046511103)
(0 -8796093022207)
(0 -17592186044415)
(0 -35184372088831)
(0 -70368744177663)
(0 -140737488355327)
(0 -281474976710655)
(0 -562949953421311)
(0 -1125899906842623)
(0 -2251799813685247)
(0 -4503599627370495)
(0 -9007199254740991)
(0 -18014398509481983)
(0 -36028797018963967)
(0 -72057594037927935)
(0 -144115188075855871)
(0 -288230376151711743)
(0 -576460752303423487)
(0 -1152921504606846975)
(0 -2305843009213693951)
(0 -4611686018427387903)
(0 -9223372036854775807)
(0 -18446744073709551615)
(0 33300140732146818380750772381422989832214186835186851059977249)
(0 12387131)
(0 1272314)
(0 231)
(0 -131)
(0 -561823)
(0 23713)
(0 -1234611312123)
(0 444121)
(0 991)
(0 3.1415926535897932385l0)
(0 3.4028235e38)
(0 1.4012985e-45)
(0 1.1754944e-38)
(0 1.7976931348623157d308)
(0 4.940656458412465d-324)
(0 2.2250738585072014d-308)
(0 1.189731495357231765l4932)
(0 3.6451995318824746025l-4951)
(0 3.3621031431120935063l-4932)
(0 3.4028235e38)
(0 1.4012985e-45)
(0 1.1754944e-38)
(0 -3.4028235e38)
(0 -1.4012985e-45)
(0 -1.1754944e-38)
(0 -3.4028235e38)
(0 -1.4012985e-45)
(0 -1.1754944e-38)
(0 -1.7976931348623157d308)
(0 -4.940656458412465d-324)
(0 -2.2250738585072014d-308)
(0 -1.189731495357231765l4932)
(0 -3.6451995318824746025l-4951)
(0 -3.3621031431120935063l-4932)
(0 5.960465e-8)
(0 2.9802326e-8)
(0 5.960465e-8)
(0 2.9802326e-8)
(0 1.1102230246251568d-16)
(0 5.551115123125784d-17)
(0 5.4210108624275221706l-20)
(0 2.7105054312137610853l-20)
(0 0.0)
(0 1.0)
(0 -1.0)
(0 313123.13)
(0 283143.22)
(0 -314781.9)
(0 131.283d0)
(0 8.3413812d-43)
(0 8.131238e20)
(0 -46189.26)
(0 -3.7818132e7)
(0 8.131823e-18)
(0 1312.73)
(0 0.001236112)
(0 6124.124l0)
(0 1.31231l-19)
(0 1/3)
(0 1/1000)
(0 1/1000000000000000)
(0 -10/3)
(0 -1000/7)
(0 -987129387912381/13612986912361)
(0 189729874978126783786123/1234678123487612347896123467851234671234)

Condition of type: FLOATING-POINT-INVALID-OPERATION
#<a FLOATING-POINT-INVALID-OPERATION>
Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at TEST. In: #<process TOP-LEVEL 0x10feb4f80>.
 File: "/Users/karstenpoeck/lisp/compiler/clasp/ecl-crash-fpe.lisp" (Position #196)

Provide details regarding ECL version (or preferably commit), operating system and if revelant the build options and versions of the build tools.

> (lisp-implementation-version)
(ext:lisp-implementation-vcs-id)`
(software-type)
(software-version)
(machine-type)
*features*
"16.1.3"
> 
"6d33095ddd53467b29558677cf11f92d5be4108e"
> 
(SOFTWARE-TYPE)
> 
"18.7.0"
> 
"x86_64"
> 

(:WALKER :CDR-1 :CDR-5 :DARWIN :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN
 :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :COMPLEX-FLOAT
 :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN
 :CLOS :THREADS :BOEHM-GC :ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS
 :IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14 :PREFIXED-API :FFI
 :X86_64 :COMMON :ECL)

did check and happens starting with the commit merging fpe-without-sigfpe.

I did test fpe-without-sigfpe, at least one version, so I am a bit puzzled why this happens

  • there where several commits in fpe-without-sigfpe, perhaps the error was introduced in a later commit

  • Perhaps i just run the ecl tests and not the ansi-test?

  • I also installed a security update

  • running with lldb show no error

The test always fails with this pair (0 189729874978126783786123/1234678123487612347896123467851234671234) but when I just call (if (= x y) (= y x) (not (= y x)) with these numbers, no error happens.

Does not error, if I don't compile, compile settings don't seem to have an effect