mirror of
https://github.com/frida/tinycc
synced 2024-12-24 22:16:49 +03: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. */
|
||||
/* arrays can also be used although they are not lvalues */
|
||||
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();
|
||||
mk_pointer(&vtop->type);
|
||||
gaddrof();
|
||||
@ -5954,12 +5954,15 @@ static void parse_init_elem(int expr_type)
|
||||
global_expr = 1;
|
||||
expr_const1();
|
||||
global_expr = saved_global_expr;
|
||||
/* NOTE: symbols are accepted */
|
||||
if ((vtop->r & (VT_VALMASK | VT_LVAL)) != VT_CONST
|
||||
/* NOTE: symbols are accepted, as well as lvalue for anon symbols
|
||||
(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
|
||||
|| (vtop->type.t & VT_IMPORT)
|
||||
#endif
|
||||
)
|
||||
)
|
||||
tcc_error("initializer element is not constant");
|
||||
break;
|
||||
case EXPR_ANY:
|
||||
@ -6711,6 +6714,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
|
||||
/* push global reference */
|
||||
sym = get_sym_ref(type, sec, addr, size);
|
||||
vpushsym(type, sym);
|
||||
vtop->r |= r;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
|
Loading…
Reference in New Issue
Block a user