Skip to content

Commit

Permalink
More fixes when calling an empty const Sub from :immediate #1024
Browse files Browse the repository at this point in the history
Throw on NULL PMC arguments also for CallContext (sub args)
with "CallContext: Empty PMC argument"
Closes GH #1024, t/compilers/imcc/syn/const.t test 41
  • Loading branch information
Reini Urban committed Nov 22, 2014
1 parent e25be6d commit be882a2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -9,6 +9,7 @@
+ Fix cmod_p_p_n* math dynops for NaN and Inf #1147
+ Fix floor, ceil and complex, integer math ops for NaN and Inf #422
+ Optimize printing of single numbers #828
+ More fixes when calling an empty const Sub from :immediate #1024
- Build
+ Extend auto::infnan probe to other --floatval #1146
+ Warn in Configure on experimental flags intval, floatval and gc #1148
Expand Down
4 changes: 4 additions & 0 deletions src/call/args.c
Expand Up @@ -403,6 +403,10 @@ Parrot_pcc_build_sig_object_from_op(PARROT_INTERP, ARGIN_NULLOK(PMC *signature),
? Parrot_pcc_get_pmc_constant(interp, ctx, raw_index)
: CTX_REG_PMC(interp, ctx, raw_index);

if (!pmc_value)
Parrot_ex_throw_from_c_noargs(interp,
EXCEPTION_INVALID_OPERATION,
"CallContext: Empty PMC argument");
if (arg_flags & PARROT_ARG_FLATTEN) {
dissect_aggregate_arg(interp, call_object, pmc_value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/call/context_accessors.c
@@ -1,5 +1,5 @@
/*
Copyright (C) 2009-2011, Parrot Foundation.
Copyright (C) 2009-2014, Parrot Foundation.
=head1 NAME
Expand Down
2 changes: 2 additions & 0 deletions src/pmc/callcontext.pmc
Expand Up @@ -1067,6 +1067,8 @@ return current Namespace
Pcc_cell *cells;
INTVAL num_pos, allocated_positionals;

PARROT_ASSERT(value
|| !"Push empty object into CallContext");
PARROT_ASSERT(!PObj_on_free_list_TEST(value)
|| !"Push dead object into CallContext");

Expand Down
2 changes: 1 addition & 1 deletion t/compilers/imcc/syn/const.t
Expand Up @@ -658,7 +658,7 @@ CODE
/wrong .const value/
OUT
pir_exit_code_is( <<'CODE', 1, "missing const Sub should not SEGV [GH #1024]", todo => "dubious");
pir_exit_code_is( <<'CODE', 1, "missing const Sub should not SEGV [GH #1024]");
.sub baz :immediate :anon
.const "Sub" foo = "foo"
$P1 = foo."new"()
Expand Down

0 comments on commit be882a2

Please sign in to comment.