]> git.sur5r.net Git - cc65/commitdiff
Prevent a literal string that is an argument for sizeof to be output into the
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 25 Jan 2013 20:45:40 +0000 (20:45 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 25 Jan 2013 20:45:40 +0000 (20:45 +0000)
literal pool.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5968 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/expr.c

index db1243cc2db78c58f9ce7f91d77366684aeeb776..9708ebe2cdfd4644c10722e4d4d5315d589762f5 100644 (file)
@@ -1744,6 +1744,13 @@ void hie10 (ExprDesc* Expr)
                CodeMark Mark;
                 GetCodePos (&Mark);
                hie10 (Expr);
+                /* If the expression is a literal string, release it, so it
+                 * won't be output as data if not used elsewhere.
+                 */
+                if (ED_IsLocLiteral (Expr)) {
+                    ReleaseLiteral (Expr->LVal);
+                }
+                /* Calculate the size */
                Size = CheckedSizeOf (Expr->Type);
                /* Remove any generated code */
                RemoveCode (&Mark);