Fix unhandled AST_EXPR_EXT_SIZEOF Error
This commit is contained in:
parent
f3b6f81ef5
commit
20197ee0bc
@ -396,6 +396,10 @@ static void ast_usedef_pass(AST *tlc, AST *a, AST *wholestmt) {
|
|||||||
if(a->stmtReturn.val) {
|
if(a->stmtReturn.val) {
|
||||||
ast_usedef_pass(tlc, a->stmtReturn.val, wholestmt);
|
ast_usedef_pass(tlc, a->stmtReturn.val, wholestmt);
|
||||||
}
|
}
|
||||||
|
} else if (a->nodeKind == AST_EXPR_EXT_SIZEOF) {
|
||||||
|
if (a->exprExtSizeOf.ofExpr) {
|
||||||
|
ast_usedef_pass(tlc, a->exprExtSizeOf.ofExpr, wholestmt);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stahp_node(a, "ast_usedef_pass: unhandled %s", AST_KIND_STR[a->nodeKind]);
|
stahp_node(a, "ast_usedef_pass: unhandled %s", AST_KIND_STR[a->nodeKind]);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#include<stdarg.h>
|
#include<stdarg.h>
|
||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
inline static size_t djb2(const char *str) {
|
inline static size_t djb2(const char *str) {
|
||||||
size_t hash = 5381;
|
size_t hash = 5381;
|
||||||
@ -54,4 +55,11 @@ __attribute__((format(printf, 1, 2))) static inline char *malp(const char *fmt,
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static int is_str_equal_check_null(const char *s1, const char *s2) {
|
||||||
|
if (!s1 || !s2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return !strcmp(s1, s2);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -333,7 +333,7 @@ void cg_chunk(CGState *cg, AST *a) {
|
|||||||
|
|
||||||
} else if(s->nodeKind == AST_STMT_ASSIGN) {
|
} else if(s->nodeKind == AST_STMT_ASSIGN) {
|
||||||
|
|
||||||
if(s->stmtAssign.to && is_xop(s->stmtAssign.what) == XOP_NOT_MEM && is_xop(s->stmtAssign.to) == XOP_NOT_MEM && !strcmp(xop(cg->tlc, s->stmtAssign.what), xop(cg->tlc, s->stmtAssign.to))) {
|
if(s->stmtAssign.to && is_xop(s->stmtAssign.what) == XOP_NOT_MEM && is_xop(s->stmtAssign.to) == XOP_NOT_MEM && is_str_equal_check_null(xop(cg->tlc, s->stmtAssign.what), xop(cg->tlc, s->stmtAssign.to))) {
|
||||||
// It's a noop
|
// It's a noop
|
||||||
} else if(s->stmtAssign.to) {
|
} else if(s->stmtAssign.to) {
|
||||||
if(x86_imul_supported() && s->stmtAssign.to->nodeKind == AST_EXPR_BINARY_OP && s->stmtAssign.to->exprBinOp.operator == BINOP_MUL) {
|
if(x86_imul_supported() && s->stmtAssign.to->nodeKind == AST_EXPR_BINARY_OP && s->stmtAssign.to->exprBinOp.operator == BINOP_MUL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user