# New Ticket Created by  "Mehmet Yavuz Selim Soyturk" 
# Please include the string:  [perl #41642]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41642 >


###################################
## file tail.pir:

.namespace [ 'Wrapper' ]

.sub call :method
    .param pmc params :slurpy

    .local pmc sub
    sub = getattribute self, 'sub'

    .local pmc a, b
    a = params[0]
    b = params[1]

    # no problem here
#     $P2 = sub(self, a, b)
#     .return ($P2)

    # tailcall 1
    .return sub(self, a, b)
.end

.namespace

.sub add_tail # tail call
    .param pmc wrapper
    .param pmc a
    .param pmc b

    if b == 0 goto end
    $P0 = new .Undef
    $P0 = a + 1
    $P1 = new .Undef
    $P1 = b - 1

    # no problem here
    #$P2 = wrapper.call($P0, $P1)
    #.return ($P2)

    # tailcall 2
    .return wrapper.call($P0, $P1)
  end:
    .return (a)
.end

.sub main :main
    $P0 = newclass 'Wrapper'
    addattribute $P0, 'sub'

    .local pmc wrapper
    wrapper = new 'Wrapper'
    .const .Sub add = 'add_tail'
    setattribute wrapper, 'sub', add


    $P1 = new .Float
    $P2 = new .Float
    $P1 = 1
    $P2 = 900

    $P0 = wrapper.call($P1, $P2)
    say $P0
.end

###########

That program causes me  segfault. I only did get a segfault when:
1) there is a tailcall _method_
2) the method gets its parameters with :slurpy

I don't get any error if I invoke parrot with the -G flag.

Wrapper represent my hll function and wraps a pir sub.

#########
$ uname -a
Linux laptop 2.6.17-11-386 #2 Thu Feb 1 19:50:13 UTC 2007 i686 GNU/Linux

$ gcc --version
gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



some output for perl Contigure.pl:

Determining if your C compiler is actually gcc.........................yes.
Enabling optimization...................................................no.
Determining flags for building shared libraries......................-fPIC.
Determine if parrot should be linked against a shared library..........yes.
Determining your minimum pointer alignment......................... 1 byte.
Computing native byteorder for Parrot's wordsize.............little-endian.
Test the type of va_ptr (this test is likely to segfault)..............x86.
Determining if your C library has a working S_ISREG....................yes.
Verifying that the compiler supports function pointer casts............yes.
Determining whether your compiler supports computed goto...............yes.
Determining if your compiler supports inline...........................yes.
Determining if your C library supports memalign........................yes.
Determining Parrot's revision.......................................r17213.

Reply via email to