aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrischka <grischka>2016-05-25 18:52:08 +0200
committergrischka <grischka>2016-05-25 18:52:08 +0200
commit1ca685f887310b5cbdc415cdfc3a578dbc8d82d8 (patch)
tree403efe6b4c2296128d4d0a514bea552c22cbbce5
parent9e0e05eb4ed18950b02f25efbf79ed27781fb568 (diff)
downloadtinycc-1ca685f887310b5cbdc415cdfc3a578dbc8d82d8.tar.gz
tinycc-1ca685f887310b5cbdc415cdfc3a578dbc8d82d8.tar.bz2
tccgen: gen_assign_cast(): cannot cast struct to scalar
The case below previously was causing an assertion failure in the target specific generator. It probably is not incorrect not to allow this even if gcc does. struct S { long b; }; void f(struct S *x) { struct S y[1] = { *x }; }
-rw-r--r--tccgen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 55befb1..d7f8c0d 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2523,10 +2523,13 @@ static void gen_assign_cast(CType *dt)
case VT_LLONG:
if (sbt == VT_PTR || sbt == VT_FUNC) {
tcc_warning("assignment makes integer from pointer without a cast");
+ } else if (sbt == VT_STRUCT) {
+ goto case_VT_STRUCT;
}
/* XXX: more tests */
break;
case VT_STRUCT:
+ case_VT_STRUCT:
tmp_type1 = *dt;
tmp_type2 = *st;
tmp_type1.t &= ~(VT_CONSTANT | VT_VOLATILE);