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
2523 case VT_LLONG:2523 case VT_LLONG:
2524 if (sbt == VT_PTR || sbt == VT_FUNC) {2524 if (sbt == VT_PTR || sbt == VT_FUNC) {
2525 tcc_warning("assignment makes integer from pointer without a cast");2525 tcc_warning("assignment makes integer from pointer without a cast");
2526 } else if (sbt == VT_STRUCT) {
2527 goto case_VT_STRUCT;
2526 }2528 }
2527 /* XXX: more tests */2529 /* XXX: more tests */
2528 break;2530 break;
2529 case VT_STRUCT:2531 case VT_STRUCT:
2532 case_VT_STRUCT:
2530 tmp_type1 = *dt;2533 tmp_type1 = *dt;
2531 tmp_type2 = *st;2534 tmp_type2 = *st;
2532 tmp_type1.t &= ~(VT_CONSTANT | VT_VOLATILE);2535 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