{"action":"created","issue":{"url":"https://api.github.com/repos/dylan-lang/opendylan/issues/882","labels_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/882/labels{/name}","comments_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/882/comments","events_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/882/events","html_url":"https://github.com/dylan-lang/opendylan/issues/882","id":68849028,"number":882,"title":"Compiler using HARP + MPS fails to compile common-dylan-test-suite-app","user":{"login":"waywardmonkeys","id":178582,"avatar_url":"https://avatars.githubusercontent.com/u/178582?v=3","gravatar_id":"","url":"https://api.github.com/users/waywardmonkeys","html_url":"https://github.com/waywardmonkeys","followers_url":"https://api.github.com/users/waywardmonkeys/followers","following_url":"https://api.github.com/users/waywardmonkeys/following{/other_user}","gists_url":"https://api.github.com/users/waywardmonkeys/gists{/gist_id}","starred_url":"https://api.github.com/users/waywardmonkeys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waywardmonkeys/subscriptions","organizations_url":"https://api.github.com/users/waywardmonkeys/orgs","repos_url":"https://api.github.com/users/waywardmonkeys/repos","events_url":"https://api.github.com/users/waywardmonkeys/events{/privacy}","received_events_url":"https://api.github.com/users/waywardmonkeys/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-16T05:30:54Z","updated_at":"2015-04-16T09:23:11Z","closed_at":null,"body":"After the addition of FE_INVALID support in #874, the HARP builds using MPS now fail ``make check`` as a result of crashing while compiling ``common-dylan-test-suite-app``.\r\n\r\nThis is actually interesting.\r\n\r\nThe assertion failure from MPS in the build logs looks like this:\r\n\r\n````\r\nBuilding common-dylan-test-suite... The MPS detected a problem!\r\n/opt/mps-kit-current/code/lockli.c:139: MPS ASSERTION FAILED: res == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/lockli.c:143: MPS ASSERTION FAILED: lock->claims == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/shield.c:222: MPS ASSERTION FAILED: !arena->insideShield\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/shield.c:224: MPS ASSERTION FAILED: !arena->suspended\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/lockli.c:139: MPS ASSERTION FAILED: res == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/lockli.c:143: MPS ASSERTION FAILED: lock->claims == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/shield.c:222: MPS ASSERTION FAILED: !arena->insideShield\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/shield.c:224: MPS ASSERTION FAILED: !arena->suspended\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/opt/mps-kit-current/code/seg.c:655: MPS ASSERTION FAILED: SigCheck Seg: seg\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nfdmake: build product /home/jenkins/workspace/opendylan-release-linux-lucid-x86/Bootstrap.3/databases/common-dylan-test-suite.ddb missing\r\nfdmake: build product /home/jenkins/workspace/opendylan-release-linux-lucid-x86/Bootstrap.3/lib/libcommon-dylan-test-suite.so missing\r\nfdmake: compile failed (11), see /home/jenkins/workspace/opendylan-release-linux-lucid-x86/Bootstrap.3/build/logs/compile-common-dylan-test-suite.txt\r\n````\r\n\r\nI installed a clean Ubuntu 14.04 VM and did a build using MPS 1.114.0 and current master of Open Dylan (and gcc 4.8.2).\r\n\r\nAfter the ``make`` completed, I ran ``make check``, let it crash, and then ran ``make check FDMAKE_OPTIONS=--gdb`` so that it would run the failing build process under gdb.\r\n\r\nThen, I set up signal handling in gdb correctly for MPS:\r\n\r\n````\r\nhandle SIGSEGV pass nostop noprint\r\n````\r\n\r\nAnd then I ran and it broke into the debugger here:\r\n\r\n````\r\nProgram received signal SIGFPE, Arithmetic exception.\r\n0x401ac7dd in KSVKdMM4I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n(gdb) bt\r\n#0  0x401ac7dd in KSVKdMM4I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#1  0x413a7936 in KCSVdfmc_modelingMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-modeling.so\r\n#2  0x434f5b74 in ?? ()\r\n#3  0x401a13b6 in Khandle_missed_dispatchVKgI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#4  0x40207c8f in general_engine_node_n ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#5  0x413d2a38 in KCTVdfmc_modeling ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-modeling.so\r\n#6  0xbfffd830 in ?? ()\r\n#7  0x401980c2 in KapplyVKdI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#8  0x41c1e905 in Kfold_function_callVdfmc_optimizationMM2I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#9  0x41c1e6c2 in Kmaybe_fold_function_callVdfmc_optimizationI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#10 0x41c429f2 in KoptimizeVdfmc_optimizationMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#11 0x41c42a21 in KoptimizeVdfmc_optimizationMM2I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#12 0x41c42902 in Kdo_optimizeVdfmc_optimizationI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#13 0x41c427de in Krun_optimizationsVdfmc_optimizationMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#14 0x41c43bf7 in ?? ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n#15 0x41c43427 in ?? ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-optimization.so\r\n````\r\n\r\nWe can see here that it was doing a division operator on a float (``KSVKdMM4I``) and that's where it hit the floating point exception.  It did this in the context of attempting to constant fold some function calls during the optimization process.\r\n\r\nI ``cont`` a couple of times to get through this set of exceptions and then:\r\n\r\n````\r\nProgram received signal SIGFPE, Arithmetic exception.\r\n0x4024af92 in TraceStart ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n(gdb) bt\r\n#0  0x4024af92 in TraceStart ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#1  0x402500f7 in TracePoll ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#2  0x402502d4 in ArenaPoll ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#3  0x4025064f in mps_ap_fill ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#4  0x401fbc31 in primitive_alloc_s ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#5  0x415598b0 in KLcode_referencesGZ32ZconstructorVdfmc_back_endMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#6  0x402076d2 in apply_xep_1 ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#7  0xbfffd9dc in ?? ()\r\n#8  0x4155dfd4 in Klambda_heap_for_sureVdfmc_back_endI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#9  0x4155dca0 in Kmaybe_claim_computations_referencesVdfmc_back_endMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#10 0x41562a81 in Kdrain_pending_elementsVdfmc_back_endI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#11 0x415627db in Ktrace_heap_from_rootsVdfmc_back_endMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#12 0x4155af55 in Kcompute_compilation_record_heapVdfmc_back_endMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#13 0x41564d1b in Kprecompute_library_heapsVdfmc_back_endMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-back-end.so\r\n#14 0x405116e4 in Kdo_with_profilingYcommon_dylan_internalsVcommon_dylanI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libcommon-dylan.so\r\n#15 0x40fa3548 in Kdo_timing_compilation_phaseVdfmc_managementI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdfmc-management.so\r\n````\r\n\r\nI'm not sure why we hit this code path here in the GC (MPS people?), but we did.\r\n\r\nI ``cont`` from there and:\r\n\r\n````\r\n(gdb) cont\r\nContinuing.\r\nThe MPS detected a problem!\r\n/home/bruce/Development/mps-kit-1.114.0/code/lockli.c:139: MPS ASSERTION FAILED: res == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/home/bruce/Development/mps-kit-1.114.0/code/lockli.c:143: MPS ASSERTION FAILED: lock->claims == 0\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/home/bruce/Development/mps-kit-1.114.0/code/shield.c:222: MPS ASSERTION FAILED: !arena->insideShield\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\nThe MPS detected a problem!\r\n/home/bruce/Development/mps-kit-1.114.0/code/shield.c:224: MPS ASSERTION FAILED: !arena->suspended\r\nSee the \"Assertions\" section in the reference manual:\r\nhttp://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\r\n\r\nProgram received signal SIGFPE, Arithmetic exception.\r\n0x40232ae1 in BufferDetach ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n````\r\n\r\nAt that point, the stack trace looks like:\r\n\r\n````\r\n0x40232ae1 in BufferDetach ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n(gdb) bt\r\n#0  0x40232ae1 in BufferDetach ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#1  0x40233738 in BufferFill ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#2  0x40250701 in mps_ap_fill ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#3  0x401fb9ff in primitive_alloc_s2 ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#4  0x401aa765 in KLarithmetic_domain_errorGZ32ZconstructorVKiMM0I ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#5  0x401ace4f in Kfloat_invalidVKeI ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#6  0xbfffd7f8 in ?? ()\r\n#7  0x402091d8 in dylan_float_invalid_handler ()\r\n   from /home/bruce/Development/opendylan/Bootstrap.3/bin/../lib/libdylan.so\r\n#8  0x4031f000 in ?? ()\r\nBacktrace stopped: previous frame inner to this frame (corrupt stack?)\r\n````\r\n\r\nSo, we can see that (as is usual for a ``lockli.c, res == 0`` assertion failure) we've re-entered MPS from the signal handler. We were inside of ``TraceStart``, hit the FP exception, and then in the signal handler, we re-entered MPS to allocate the error object which allocated and caused a re-entry into MPS.\r\n"},"comment":{"url":"https://api.github.com/repos/dylan-lang/opendylan/issues/comments/93689185","html_url":"https://github.com/dylan-lang/opendylan/issues/882#issuecomment-93689185","issue_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/882","id":93689185,"user":{"login":"gareth-rees","id":922721,"avatar_url":"https://avatars.githubusercontent.com/u/922721?v=3","gravatar_id":"","url":"https://api.github.com/users/gareth-rees","html_url":"https://github.com/gareth-rees","followers_url":"https://api.github.com/users/gareth-rees/followers","following_url":"https://api.github.com/users/gareth-rees/following{/other_user}","gists_url":"https://api.github.com/users/gareth-rees/gists{/gist_id}","starred_url":"https://api.github.com/users/gareth-rees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gareth-rees/subscriptions","organizations_url":"https://api.github.com/users/gareth-rees/orgs","repos_url":"https://api.github.com/users/gareth-rees/repos","events_url":"https://api.github.com/users/gareth-rees/events{/privacy}","received_events_url":"https://api.github.com/users/gareth-rees/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T09:23:11Z","updated_at":"2015-04-16T09:23:11Z","body":"Richard's away on holiday at the moment, but I’ll try to see what I can deduce from the traceback. The problem is the floating-point exception in [`TraceStart`](https://github.com/Ravenbrook/mps-temporary/blob/master/code/trace.c#L1622). However, I don't immediately see how a floating-point exception can arise in this code.\r\n\r\nThere are only two floating-point operations in this code. First, the prediction of the survivors:\r\n```\r\ntrace->condemned * (1.0 - mortality)\r\n```\r\nbut the code asserts that `0.0 <= mortality <= 1.0` so I don't think this can underflow.\r\n\r\nSecond:\r\n```\r\n    double nPolls = finishingTime / ArenaPollALLOCTIME;\r\n```\r\nbut here `ArenaPollALLOCTIME` is a macro that expands to `(65536.0)` and `finishingTime` was computed in `TracePoll` as `trace->condemned * TraceWorkFactor` where `trace->condemned` is a `size_t` and `TraceWorkFactor` is `0.25`.\r\n\r\nSo I do not understand where the floating-point exception can be coming from!"}}