mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
Fix bogus check for VT_LLOCAL types
VT_LLOCAL is a flag on .r, not on type.t. Fixing this requires minor surgery for compound literals which accidentally happened to be subsumed by the bogus test.
This commit is contained in:
parent
24420bb5c0
commit
8b9697ca6b
12
tccgen.c
12
tccgen.c
@ -4443,7 +4443,7 @@ ST_FUNC void unary(void)
|
|||||||
there and in function calls. */
|
there and in function calls. */
|
||||||
/* arrays can also be used although they are not lvalues */
|
/* arrays can also be used although they are not lvalues */
|
||||||
if ((vtop->type.t & VT_BTYPE) != VT_FUNC &&
|
if ((vtop->type.t & VT_BTYPE) != VT_FUNC &&
|
||||||
!(vtop->type.t & VT_ARRAY) && !(vtop->type.t & VT_LLOCAL))
|
!(vtop->type.t & VT_ARRAY))
|
||||||
test_lvalue();
|
test_lvalue();
|
||||||
mk_pointer(&vtop->type);
|
mk_pointer(&vtop->type);
|
||||||
gaddrof();
|
gaddrof();
|
||||||
@ -5954,12 +5954,15 @@ static void parse_init_elem(int expr_type)
|
|||||||
global_expr = 1;
|
global_expr = 1;
|
||||||
expr_const1();
|
expr_const1();
|
||||||
global_expr = saved_global_expr;
|
global_expr = saved_global_expr;
|
||||||
/* NOTE: symbols are accepted */
|
/* NOTE: symbols are accepted, as well as lvalue for anon symbols
|
||||||
if ((vtop->r & (VT_VALMASK | VT_LVAL)) != VT_CONST
|
(compound literals). */
|
||||||
|
if (((vtop->r & (VT_VALMASK | VT_LVAL)) != VT_CONST
|
||||||
|
&& ((vtop->r & (VT_SYM|VT_LVAL)) != (VT_SYM|VT_LVAL)
|
||||||
|
|| vtop->sym->v < SYM_FIRST_ANOM))
|
||||||
#ifdef TCC_TARGET_PE
|
#ifdef TCC_TARGET_PE
|
||||||
|| (vtop->type.t & VT_IMPORT)
|
|| (vtop->type.t & VT_IMPORT)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
tcc_error("initializer element is not constant");
|
tcc_error("initializer element is not constant");
|
||||||
break;
|
break;
|
||||||
case EXPR_ANY:
|
case EXPR_ANY:
|
||||||
@ -6711,6 +6714,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
|
|||||||
/* push global reference */
|
/* push global reference */
|
||||||
sym = get_sym_ref(type, sec, addr, size);
|
sym = get_sym_ref(type, sec, addr, size);
|
||||||
vpushsym(type, sym);
|
vpushsym(type, sym);
|
||||||
|
vtop->r |= r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_TCC_BCHECK
|
#ifdef CONFIG_TCC_BCHECK
|
||||||
|
Loading…
Reference in New Issue
Block a user