History

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 }; }

grischka committed 10 years ago

Commit 1ca685f1 parent 9e0e05e1 file · +3 −0Browse files

Unified · Split

tccgen.c+3−0
@@ -2523,10 +2523,13 @@ static void gen_assign_cast(CType *dt) · 2522 unmodified lines
25232523 case VT_LLONG:
25242524 if (sbt == VT_PTR || sbt == VT_FUNC) {
25252525 tcc_warning("assignment makes integer from pointer without a cast");
2526+ } else if (sbt == VT_STRUCT) {
2527+ goto case_VT_STRUCT;
25262528 }
25272529 /* XXX: more tests */
25282530 break;
25292531 case VT_STRUCT:
2532+ case_VT_STRUCT:
25302533 tmp_type1 = *dt;
25312534 tmp_type2 = *st;
25322535 tmp_type1.t &= ~(VT_CONSTANT | VT_VOLATILE);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t