1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@960 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-09-21 13:48:55 +00:00
parent edcc015a48
commit fa1f814be5

View File

@ -240,20 +240,23 @@ static void ParseOneDecl (const DeclSpec* Spec)
/* Skip the '=' */ /* Skip the '=' */
NextToken (); NextToken ();
/* Get the expression into the primary */
expression1 (&lval);
/* Make type adjustments if needed */
assignadjust (Decl.Type, &lval);
/* Setup the type flags for the assignment */ /* Setup the type flags for the assignment */
flags = TypeOf (Decl.Type); flags = Size == 1? CF_FORCECHAR : CF_NONE;
if (Size == 1) {
flags |= CF_FORCECHAR; /* Get the expression into the primary */
if (evalexpr (flags, hie1, &lval) == 0) {
/* Constant expression. Adjust the types */
assignadjust (Decl.Type, &lval);
flags |= CF_CONST;
/* Load it into the primary */
exprhs (flags, 0, &lval);
} else {
/* Expression is not constant and in the primary */
assignadjust (Decl.Type, &lval);
} }
/* Store the value into the variable */ /* Store the value into the variable */
g_putstatic (flags, SymData, 0); g_putstatic (flags | TypeOf (Decl.Type), SymData, 0);
/* Mark the variable as referenced */ /* Mark the variable as referenced */
SC |= SC_REF; SC |= SC_REF;