Ticket #445 (closed bug: fixed)

Opened 13 years ago

Last modified 11 years ago

[bug] Darwin string buffering segfault in examples/shootout/revcomp.pir

Reported by: allison Owned by: mikehh
Priority: normal Milestone:
Component: testing Version:
Severity: medium Keywords:
Cc: chromatic, allison Language:
Patch status: Platform: all

Description

examples/shootout/revcomp.pir (which is also t/examples/shootout_17.pir) is failing with a segfault on MacOS 10.5.6. I would assume that this is just a broken XCode install on this machine, but it appears that jkeenan was failing the same test in TT #438. So, I'm skipping this test on darwin for now. You can duplicate the failure with:

./parrot examples/shootout/revcomp.pir < examples/shootout/revcomp.pir_input

gcc installed with XCode 3.0 gives the following error:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x002df3bc
0xffff07c2 in ___memcpy () at /System/Library/Frameworks/System.framework/PrivateHeaders/i386/cpu_capabilities.h:246
246     /System/Library/Frameworks/System.framework/PrivateHeaders/i386/cpu_capabilities.h: No such file or directory.  
        in /System/Library/Frameworks/System.framework/PrivateHeaders/i386/cpu_capabilities.h
(gdb) bt
#0  0xffff07c2 in ___memcpy () at /System/Library/Frameworks/System.framework/PrivateHeaders/i386/cpu_capabilities.h:246
#1  0x007ad57b in Parrot_io_write_buffer (interp=0xd01760, filehandle=0x2a9008, s=0x2ce17c) at src/io/buffer.c:638
#2  0x008723a1 in Parrot_FileHandle_nci_puts (interp=0xd01760, pmc=0x1e8a0) at filehandle.pmc:518
#3  0x007e540a in Parrot_NCI_invoke (interp=0xd01760, pmc=0x1e8a0, next=0x0) at nci.pmc:330
#4  0x006c5c0d in Parrot_PCCINVOKE (interp=0xd01760, pmc=0x2a9008, method_name=0x1006e18, signature=0x9355fc "S->I") at src/call/pcc.c:2848
#5  0x007ab1c9 in Parrot_io_putps (interp=0xd01760, pmc=0x2a9008, s=0x2ce17c) at src/io/api.c:458
#6  0x0064b19e in Parrot_print_s (cur_opcode=0x104d468, interp=0xd01760) at io.ops:194
#7  0x00716464 in runops_slow_core (interp=0xd01760, pc=0x104d468) at src/runops_cores.c:461
#8  0x006c9726 in runops_int (interp=0xd01760, offset=39) at src/interpreter.c:980
#9  0x006ca1b0 in runops (interp=0xd01760, offs=39) at src/call/ops.c:107
#10 0x006ca469 in runops_args (interp=0xd01760, sub=0x2a8ba0, obj=0x103a2b0, meth_unused=0x0, sig=0x930ab4 "vP", ap=0xbfffecac "p�*") at src/call/ops.c:254
#11 0x006cb2ba in Parrot_runops_fromc_args (interp=0xd01760, sub=0x2a8ba0, sig=0x930ab4 "vP") at src/call/ops.c:321
#12 0x006a764e in Parrot_runcode (interp=0xd01760, argc=1, argv=0xbfffedc0) at src/embed.c:1011

On some research, the missing cpu_capabilities.h appears to be a problem with an (incompletely or badly) upgraded XCode install. Upgrading to XCode 3.1.2 changes the error in gdb to a more obscure and less useful:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x002df3f8
0xffff07c2 in ?? ()
(gdb) bt
#0  0xffff07c2 in ?? ()
#1  0xbfffea68 in ?? ()

Creating a ticket to refer to in the skip.

Change History

  Changed 13 years ago by chromatic

  • platform set to all

I can duplicate this on x86 Linux as well, as of r37505. I've skipped the test for all platforms.

The problem is that the ->strstart member of the STRING being printed points to an invalid location. I'm not sure where it goes wrong; it looks like somewhere in parameter passing through the PCCINVOKE.

follow-up: ↓ 3   Changed 12 years ago by mikehh

I don't know if this bug still exists - at r42089 with Ubuntu 9.10 (beta updated) amd64 the test passes for me.

In fact I can unskip all tests in t/examples/shootout.t and the test passes - I left the skip test for GMP (I have gmp so it doesn't skip) but removed (commented out) the others and all sub-tests pass (for me).

in reply to: ↑ 2   Changed 12 years ago by jkeenan

Replying to mikehh:

I don't know if this bug still exists - at r42089 with Ubuntu 9.10 (beta updated) amd64 the test passes for me. In fact I can unskip all tests in t/examples/shootout.t and the test passes - I left the skip test for GMP (I have gmp so it doesn't skip) but removed (commented out) the others and all sub-tests pass (for me).

Likewise for me on Linux/i386 and Darwin/PPC.

But when I see output like this on Darwin/PPC ...

ok 14 # skip recursive-2.pir float JIT broken on non-x86
ok 15 # skip recursive.pir float JIT broken on non-x86
examples/shootout/regexdna.pir  < examples/shootout/regexdna.pir_input 
ok 16 - examples/shootout/regexdna.pir
ok 17 # skip revcomp.pir string buffering segfault, TT #445

I have to wonder: Are tests 14 and 15 passing only because we have, for all practical purposes, zeroed out our JIT system pending reconstruction?

If not, then the following patch could be applied:

Index: t/examples/shootout.t
===================================================================
--- t/examples/shootout.t       (revision 42176)
+++ t/examples/shootout.t       (working copy)
@@ -47,9 +47,6 @@
 
 my %skips = (
     'pidigits.pir'    => [ 'not exists $PConfig{HAS_GMP}', 'needs GMP' ],
-    'recursive.pir'   => [ '$PConfig{cpuarch} !~ /86/',    'float JIT broken on non-x86' ],
-    'recursive-2.pir' => [ '$PConfig{cpuarch} !~ /86/',    'float JIT broken on non-x86' ],
-    'revcomp.pir'     => [ '1',              'string buffering segfault, TT #445' ],
 );
 my $INPUT_EXT = '_input';
 foreach my $script (@shootouts) {

kid51

follow-up: ↓ 5   Changed 12 years ago by mikehh

I am removing the skipped tests here (except the GMP one) in r42572, and will close this ticket if I get no negative feedback over the next few days

in reply to: ↑ 4   Changed 11 years ago by jkeenan

  • cc chromatic, allison added
  • owner set to mikehh
  • component changed from none to testing

Replying to mikehh:

I am removing the skipped tests here (except the GMP one) in r42572, and will close this ticket if I get no negative feedback over the next few days

mikehh,

Is there some reason you kept this ticket open? (Assigning to you, cc-ing chromatic, allison.)

For the record: On Darwin/PPC, all t/examples/shootout.t has been a PASS for me for some time now.

Thank you very much.

kid51

  Changed 11 years ago by mikehh

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

Should have closed this months ago. Closing this ticket as resolved fixed

Note: See TracTickets for help on using tickets.