[svn:parrot] r39725 - trunk/compilers/imcc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Jun 22 21:39:28 UTC 2009


Author: NotFound
Date: Mon Jun 22 21:39:26 2009
New Revision: 39725
URL: https://trac.parrot.org/parrot/changeset/39725

Log:
[imcc] catch the segfault in TT #737

Modified:
   trunk/compilers/imcc/pcc.c

Modified: trunk/compilers/imcc/pcc.c
==============================================================================
--- trunk/compilers/imcc/pcc.c	Mon Jun 22 20:39:10 2009	(r39724)
+++ trunk/compilers/imcc/pcc.c	Mon Jun 22 21:39:26 2009	(r39725)
@@ -743,6 +743,9 @@
 
     SymReg * const sub = ins->symregs[0];
 
+    PARROT_ASSERT(sub);
+    PARROT_ASSERT(sub->pcc_sub);
+
     if (ins->type & ITRESULT) {
         const int n = sub->pcc_sub->nret;
         ins         = pcc_get_args(interp, unit, ins, "get_results", n,
@@ -767,6 +770,11 @@
 
     if (ins->type & ITCALL) {
         SymReg * const the_sub = sub->pcc_sub->sub;
+        /* If this condition is true the generator must haven't be called,
+         * but check it as a last resort.
+         * See also TT #737 */
+        if (the_sub == NULL)
+            IMCC_fatal(interp, 1, "expand_pcc_sub_call: no such sub");
 
         if (!meth_call && (the_sub->type & VTADDRESS)) {
             /* sub->pcc_sub->sub is an actual subroutine name, not a variable */


More information about the parrot-commits mailing list