Ticket #66 (closed bug: invalid)

Opened 6 years ago

Last modified 6 years ago

partcl's "expr-old.test" spec test file exposes segfault (r34059)

Reported by: coke Owned by:
Priority: major Milestone:
Component: none Version:
Severity: fatal Keywords: tcl blocker
Cc: Language:
Patch status: Platform:

Description

The full version gives a bus error. With a stripped down version inline below, I get a segfault (switches to a bus error if you use -G) that ends with the stack trace below. I think it's related to the mod opcode (which shows up in the stack trace); it consistently presents a problem when invoking the tcl: {expr 2%0} (but without all the extra code, it properly complains about modulus 0.)

See  http://code.google.com/p/partcl/wiki/PartclSource for instructions on getting a copy of partcl to duplicate the issue with. if you save the file below as "foo.tcl", you can get the segfault with "../../parrot tcl.pbc foo.tcl" (after building partcl).

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x5954495e
0x010911cf in clone_key_arg (interp=0x2506bc0, st=0xbfffa21c) at src/inter_call.c:972
972         if (key->vtable->base_type != enum_class_Key)
(gdb) bt
#0  0x010911cf in clone_key_arg (interp=0x2506bc0, st=0xbfffa21c) at src/inter_call.c:972
#1  0x01092276 in Parrot_convert_arg (interp=0x2506bc0, st=0xbfffa21c) at src/inter_call.c:1585
#2  0x01091e02 in Parrot_process_args (interp=0x2506bc0, st=0xbfffa21c, param_or_result=PARROT_PASS_PARAMS) at src/inter_call.c:1457
#3  0x010923f2 in parrot_pass_args (interp=0x2506bc0, src_ctx=0x3a35980, dest_ctx=0x6592c60, src_indexes=0x2410514, dest_indexes=0x2422e64, param_or_result=PARROT_PASS_PARAMS) at src/inter_call.c:1651
#4  0x0100f5d0 in Parrot_get_params_pc (cur_opcode=0x2422e64, interp=0x2506bc0) at src/ops/core.ops:601
#5  0x010d8926 in runops_slow_core (interp=0x2506bc0, pc=0x2422e64) at src/runops_cores.c:222
#6  0x01096f3e in runops_int (interp=0x2506bc0, offset=5346) at src/interpreter.c:938
#7  0x010978d3 in runops (interp=0x2506bc0, offs=5346) at src/inter_run.c:103
#8  0x01097ba3 in runops_args (interp=0x2506bc0, sub=0x43edde0, obj=0x283c178, meth_unused=0x0, sig=0x12f9a54 "vP", ap=0xbfffa45c "xK8\004ÀkP\002\002") at src/inter_run.c:240
#9  0x01097cd8 in Parrot_runops_fromc_args (interp=0x2506bc0, sub=0x43edde0, sig=0x12f9a54 "vP") at src/inter_run.c:305
#10 0x0107fc64 in Parrot_ex_throw_from_c (interp=0x2506bc0, exception=0x4384b78) at src/exceptions.c:327
#11 0x0107fd11 in Parrot_ex_throw_from_c_args (interp=0x2506bc0, ret_addr=0x0, exitcode=30, format=0x132efe0 "int modulus by zero") at src/exceptions.c:394
#12 0x011c4616 in Parrot_Integer_multi_modulus_DEFAULT_PMC (interp=0x2506bc0, pmc=0x4387214, value=0x4385aac, dest=0x4384e50) at ./src/pmc/integer.pmc:961
#13 0x010a26bd in pcf_P_JPPP (interp=0x2506bc0, self=0x2845870) at src/nci.c:629
#14 0x011b844f in Parrot_NCI_invoke (interp=0x2506bc0, pmc=0x2845870, next=0x0) at ./src/pmc/nci.pmc:321
#15 0x0109421c in Parrot_pcc_invoke_sub_from_sig_object (interp=0x2506bc0, sub_obj=0x2845870, sig_obj=0x4384e18) at src/inter_call.c:2659
#16 0x0109e4a4 in Parrot_mmd_multi_dispatch_from_c_args (interp=0x2506bc0, name=0x12fab28 "modulus", sig=0x1307e9c "PPP->P") at src/multidispatch.c:496
#17 0x01175f74 in Parrot_default_modulus (interp=0x2506bc0, pmc=0x4387214, value=0x4385aac, dest=0x4384e50) at ./src/pmc/default.pmc:1656
#18 0x01025b30 in Parrot_mod_p_p_p (cur_opcode=0x243adb4, interp=0x2506bc0) at src/ops/math.ops:799
#19 0x010d8926 in runops_slow_core (interp=0x2506bc0, pc=0x243adb4) at src/runops_cores.c:222
#20 0x01096f3e in runops_int (interp=0x2506bc0, offset=3301) at src/interpreter.c:938
#21 0x010978d3 in runops (interp=0x2506bc0, offs=3301) at src/inter_run.c:103
#22 0x01097ba3 in runops_args (interp=0x2506bc0, sub=0x6247454, obj=0x283c178, meth_unused=0x0, sig=0x12f9a54 "vP", ap=0xbfffc8cc "~Hn$\006ÀkP\002\002") at src/inter_run.c:240
#23 0x01097cd8 in Parrot_runops_fromc_args (interp=0x2506bc0, sub=0x6247454, sig=0x12f9a54 "vP") at src/inter_run.c:305
#24 0x0107fc64 in Parrot_ex_throw_from_c (interp=0x2506bc0, exception=0x6246e88) at src/exceptions.c:327
#25 0x0107fd11 in Parrot_ex_throw_from_c_args (interp=0x2506bc0, ret_addr=0x0, exitcode=20, format=0x130c0cc "Class %Ss already registered!\n") at src/exceptions.c:394
#26 0x010cc488 in fail_if_type_exists (interp=0x2506bc0, name=0x6246ec0) at src/oo.c:533
...

And here's the tcl code:

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest 2.1
    namespace import -force ::tcltest::*
}


proc testIEEE {} {
    variable ieeeValues
    binary scan [binary format dd -1.0 1.0] c* c
    switch -exact -- $c {
        {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
            # little endian
            binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
                ieeeValues(-Infinity)
            binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
                ieeeValues(-Normal)
            binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
                ieeeValues(-Subnormal)
            binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
                ieeeValues(-0)
            binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(+0)
            binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
                ieeeValues(+Subnormal)
            binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
                ieeeValues(+Normal)
            binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
                ieeeValues(+Infinity)
            binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
                ieeeValues(NaN)
            set ieeeValues(littleEndian) 1
            return 1
        }
        {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
            binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(-Infinity)
            binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(-Normal)
            binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(-Subnormal)
            binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(-0)
            binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(+0)
            binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(+Subnormal)
            binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(+Normal)
            binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(+Infinity)
            binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
                ieeeValues(NaN)
            set ieeeValues(littleEndian) 0
            return 1
        }
        default {
            return 0
        }
    }
}

testConstraint ieeeFloatingPoint [testIEEE]
catch {expr 2%0} msg

Change History

Changed 6 years ago by coke

  • severity changed from medium to high

Changed 6 years ago by coke

  • summary changed from partcl's "expr-old.test" spec test file exposes segfault to partcl's "expr-old.test" spec test file exposes segfault (r34059)

Changed 6 years ago by coke

Two notes:

  • before the test file crashes, 254 tests are seen to pass; that's about 11% of the total pass rate for partcl's test suite in all the other test files so far, so getting this working will give us a big boost.
  • Patrick reported a very similar segfault earlier on #parrot

Changed 6 years ago by coke

Segfault is still present in parrot r35922, partcl r275.

Changed 6 years ago by coke

  • priority changed from normal to major
  • keywords tcl blocker added
  • severity changed from high to fatal

This segfault still occurs in partcl r387, parrot version 39220, on linux.

Changed 6 years ago by coke

  • status changed from new to closed
  • resolution set to invalid

I'm not getting hte segfault anymore - this file just runs out of memory.

Note: See TracTickets for help on using tickets.