Ticket #792 (new bug)

Opened 5 years ago

Last modified 5 years ago

Bug in subroutine calling conventions

Reported by: Axle Owned by:
Priority: normal Milestone:
Component: core Version: 1.0.0
Severity: medium Keywords: subroutine calling
Cc: Language:
Patch status: Platform: linux

Description

When running this code with the command 'parrot -':

.sub 'main' :main

'aux'(5, 'hello', "b" => 3.14)

.end

.sub 'aux'

.param int a

.param num b :named("b")

.param string c :optional

.param int has_c :opt_flag

say a

say b

say c

.end

I get this error:

FixedIntegerArray: index out of bounds!

current instr.: 'aux' pc 16 (-:5)

called from Sub 'main' pc 11 (-:2)

Change History

  Changed 5 years ago by allison

  • status changed from new to assigned
  • owner set to allison

follow-up: ↓ 3   Changed 5 years ago by allison

The problem is that you put a named parameter ('b') in before the last positional parameter ('c'). Named parameters must follow all positional parameters in the declaration list.

But, agreed that the error message isn't at all helpful, that will need to be fixed.

in reply to: ↑ 2   Changed 5 years ago by Axle

Replying to allison:

The problem is that you put a named parameter ('b') in before the last positional parameter ('c'). Named parameters must follow all positional parameters in the declaration list. But, agreed that the error message isn't at all helpful, that will need to be fixed.

Ah. Sorry this isn't a real bug. Thanks for the help.

  Changed 5 years ago by coke

  • owner changed from allison to coke
  • status changed from assigned to new

This sample now generates the following output:

5
0

allison - is this new, non erroring behavior now correct? If so, we can add a test and close the ticket.

  Changed 5 years ago by coke

  • owner coke deleted
Note: See TracTickets for help on using tickets.