shithub: mc

Download patch

ref: 68f6db30794bf0d5390fc895063e62306fc72753
parent: e5bd1ef7fc9a04d39988e1dc4bac08a3f5705f88
author: Ori Bernstein <[email protected]>
date: Mon Jul 23 21:52:38 EDT 2012

Don't allow NULL types to pass through.

    They're always a bug.

--- a/8/simp.c
+++ b/8/simp.c
@@ -209,7 +209,7 @@
 
     sz = 0;
     if (!t)
-        return 0;
+        die("size of empty type => bailing.");
     switch (t->type) {
         case Tyvoid:
             die("void has no size");
@@ -257,7 +257,8 @@
         case Tyunion:
             sz = Wordsz;
             for (i = 0; i < t->nmemb; i++)
-                sz = max(sz, tysize(t->udecls[i]->etype) + Wordsz);
+                if (t->udecls[i]->etype)
+                    sz = max(sz, tysize(t->udecls[i]->etype) + Wordsz);
             return sz;
             break;
         case Tybad: case Tyvar: case Typaram: case Tyname: case Ntypes: