Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #32421] Bug: segfault in imcc parsing bad if statement

1 view
Skip to first unread message

Gopal V

unread,
Nov 12, 2004, 1:16:31 PM11/12/04
to bugs-bi...@rt.perl.org
# New Ticket Created by Gopal V
# Please include the string: [perl #32421]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32421 >


The following code segfaults with parrot poicephalus

.sub _MAIN
$I0=1
if$I0 < 2 goto LBL1
LBL1:
end
ret
.end

Fix at your leisure :)


__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com

Matt Diephouse

unread,
Nov 12, 2004, 4:59:02 PM11/12/04
to perl6-i...@perl.org, bugs-bi...@rt.perl.org
On Fri, 12 Nov 2004 10:16:31 -0800, via RT Gopal V
<parrotbug...@parrotcode.org> wrote:
> # New Ticket Created by Gopal V
> # Please include the string: [perl #32421]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32421 >
>
> The following code segfaults with parrot poicephalus
>
> .sub _MAIN
> $I0=1
> if$I0 < 2 goto LBL1
> LBL1:
> end
> ret
> .end
>
> Fix at your leisure :)

The code works if you put a space between "if" and "$I0":

.sub _MAIN
$I0=1
if $I0 < 2 goto LBL1
LBL1:
end
ret
.end

--
matt diephouse
http://matt.diephouse.com

Dan Sugalski

unread,
Nov 12, 2004, 5:05:44 PM11/12/04
to ma...@diephouse.com, perl6-i...@perl.org, bugs-bi...@rt.perl.org, Matt Diephouse
At 4:59 PM -0500 11/12/04, Matt Diephouse wrote:
>On Fri, 12 Nov 2004 10:16:31 -0800, via RT Gopal V
><parrotbug...@parrotcode.org> wrote:
>> # New Ticket Created by Gopal V
>> # Please include the string: [perl #32421]
>> # in the subject line of all future correspondence about this issue.
>> # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32421 >
>>
>> The following code segfaults with parrot poicephalus
>>
>> .sub _MAIN
>> $I0=1
>> if$I0 < 2 goto LBL1
>> LBL1:
>> end
>> ret
>> .end
>>
>> Fix at your leisure :)
>
>The code works if you put a space between "if" and "$I0":

Right, but the pir parser shouldn't segfault on bad input.
--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Leopold Toetsch

unread,
Nov 12, 2004, 5:07:36 PM11/12/04
to perl6-i...@perl.org
[This message has also been posted.]

Gopal V <parrotbug...@parrotcode.org> wrote:
> # New Ticket Created by Gopal V
> # Please include the string: [perl #32421]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32421 >


> The following code segfaults with parrot poicephalus

> .sub _MAIN
> $I0=1
> if$I0 < 2 goto LBL1

^^^^^

Segfault in the lexer. Bad.

349 sprintf(label, "%s%d", yytext, frames->label);
(gdb) p frames
$1 = (struct macro_frame_t *) 0x0

leo

Gopal V

unread,
Nov 13, 2004, 8:23:33 AM11/13/04
to parrotbug...@parrotcode.org

> Segfault in the lexer. Bad.
>
> 349 sprintf(label, "%s%d", yytext,
> frames->label);
> (gdb) p frames
> $1 = (struct macro_frame_t *) 0x0

I didn't know how or why or what a frame is in this
context which is why this isn't a patch :)

Leopold Toetsch

unread,
Nov 16, 2004, 3:55:00 AM11/16/04
to Gopal V, perl6-i...@perl.org
Gopal V <gopa...@yahoo.com> wrote:

>> Segfault in the lexer. Bad.
>>
>> 349 sprintf(label, "%s%d", yytext,
>> frames->label);
>> (gdb) p frames
>> $1 = (struct macro_frame_t *) 0x0

> I didn't know how or why or what a frame is in this
> context which is why this isn't a patch :)

No problem. The syntax {ID}$ is used internally during the expansion of
local labels inside macros, which happen to be accumulated in frame
structures.

Fixed.

Thanks for reporting,
leo

0 new messages