cc: fix void cast crash
the following code reproduces the crash: void foo(void) { } void main(int argc, char **argv) { (void)(1 ? (void)0 : foo()); } the problem is that side() gives a false positive on the OCOND with later constant folding eleminating the acutal side effect and OCAST ending up with two nested OCATS with the nested one being zapped (type == T).
This commit is contained in:
parent
d1204d9b80
commit
766a641d25
1 changed files with 5 additions and 0 deletions
|
@ -1081,6 +1081,11 @@ loop:
|
||||||
if(castucom(n))
|
if(castucom(n))
|
||||||
warn(n, "32-bit unsigned complement zero-extended to 64 bits");
|
warn(n, "32-bit unsigned complement zero-extended to 64 bits");
|
||||||
ccom(l);
|
ccom(l);
|
||||||
|
if(l->type == T){
|
||||||
|
n->left = Z;
|
||||||
|
n->type = T;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(l->op == OCONST) {
|
if(l->op == OCONST) {
|
||||||
evconst(n);
|
evconst(n);
|
||||||
if(n->op == OCONST)
|
if(n->op == OCONST)
|
||||||
|
|
Loading…
Reference in a new issue