shithub: mc

Download patch

ref: da9b21b4313efbb023d6d7da6417941c6275b181
parent: dc6135b7b6b30fb07d2ac661e56f23be8c12f8f7
author: Ori Bernstein <[email protected]>
date: Tue Jan 7 12:09:11 EST 2014

Fix test for small inlinable constants.

--- a/mi/fold.c
+++ b/mi/fold.c
@@ -47,7 +47,16 @@
 
 static int issmallconst(Node *dcl)
 {
-    return dcl->decl.isconst && exprop(dcl->decl.init) == Olit;
+    Type *t;
+
+    if (!dcl->decl.isconst)
+        return 0;
+    if (!dcl->decl.init)
+        return 0;
+    t = tybase(exprtype(dcl->decl.init));
+    if (t->type <= Tyfloat64)
+        return 1;
+    return 0;
 }
 
 Node *fold(Node *n, int foldvar)
--- a/parse/types.def
+++ b/parse/types.def
@@ -25,6 +25,7 @@
 /*end integer types*/
 Ty(Tyfloat32, "float32")
 Ty(Tyfloat64, "float64")
+/* end primitive types */
 Ty(Tyvalist, NULL)
 
 /* end atomic types */