Unified · Split
| @@ -454,7 +454,7 @@ static Sym *external_sym(int v, CType *type, int r, char *asm_label) · 453 unmodified lines | |||
| 454 | if (!s) { | 454 | if (!s) { |
| 455 | /* push forward reference */ | 455 | /* push forward reference */ |
| 456 | s = sym_push(v, type, r | VT_CONST | VT_SYM, 0); | 456 | s = sym_push(v, type, r | VT_CONST | VT_SYM, 0); |
| 457 | s->asm_label = asm_label; | 457 | s->asm_label = asm_label ? tcc_strdup(asm_label) : 0; |
| 458 | s->type.t |= VT_EXTERN; | 458 | s->type.t |= VT_EXTERN; |
| 459 | } else if (s->type.ref == func_old_type.ref) { | 459 | } else if (s->type.ref == func_old_type.ref) { |
| 460 | s->type.ref = type->ref; | 460 | s->type.ref = type->ref; |
| @@ -5908,7 +5908,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 5447 unmodified lines | |||
| 5908 | if (v) { | 5908 | if (v) { |
| 5909 | if (scope != VT_CONST || !sym) { | 5909 | if (scope != VT_CONST || !sym) { |
| 5910 | sym = sym_push(v, type, r | VT_SYM, 0); | 5910 | sym = sym_push(v, type, r | VT_SYM, 0); |
| 5911 | sym->asm_label = asm_label; | 5911 | sym->asm_label = asm_label ? tcc_strdup(asm_label) : 0; |
| 5912 | } | 5912 | } |
| 5913 | /* update symbol definition */ | 5913 | /* update symbol definition */ |
| 5914 | if (sec) { | 5914 | if (sec) { |
| @@ -6139,6 +6139,7 @@ static int decl0(int l, int is_for_loop_init) · 224 unmodified lines | |||
| 6139 | CType type, btype; | 6139 | CType type, btype; |
| 6140 | Sym *sym; | 6140 | Sym *sym; |
| 6141 | AttributeDef ad; | 6141 | AttributeDef ad; |
| 6142 | char *asm_label = 0; // associated asm label | ||
| 6142 | 6143 | ||
| 6143 | while (1) { | 6144 | while (1) { |
| 6144 | if (!parse_btype(&btype, &ad)) { | 6145 | if (!parse_btype(&btype, &ad)) { |
| @@ -6174,7 +6175,6 @@ static int decl0(int l, int is_for_loop_init) · 29 unmodified lines | |||
| 6174 | continue; | 6175 | continue; |
| 6175 | } | 6176 | } |
| 6176 | while (1) { /* iterate thru each declaration */ | 6177 | while (1) { /* iterate thru each declaration */ |
| 6177 | char *asm_label; // associated asm label | ||
| 6178 | type = btype; | 6178 | type = btype; |
| 6179 | type_decl(&type, &ad, &v, TYPE_DIRECT); | 6179 | type_decl(&type, &ad, &v, TYPE_DIRECT); |
| 6180 | #if 0 | 6180 | #if 0 |
| @@ -6195,7 +6195,8 @@ static int decl0(int l, int is_for_loop_init) · 14 unmodified lines | |||
| 6195 | func_decl_list(sym); | 6195 | func_decl_list(sym); |
| 6196 | } | 6196 | } |
| 6197 | 6197 | ||
| 6198 | asm_label = NULL; | 6198 | tcc_free(asm_label); |
| 6199 | asm_label = 0; | ||
| 6199 | if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { | 6200 | if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { |
| 6200 | CString astr; | 6201 | CString astr; |
| 6201 | 6202 | ||
| @@ -6373,8 +6374,10 @@ static int decl0(int l, int is_for_loop_init) · 171 unmodified lines | |||
| 6373 | } | 6374 | } |
| 6374 | } | 6375 | } |
| 6375 | if (tok != ',') { | 6376 | if (tok != ',') { |
| 6376 | if (is_for_loop_init) | 6377 | if (is_for_loop_init) { |
| 6378 | tcc_free(asm_label); | ||
| 6377 | return 1; | 6379 | return 1; |
| 6380 | } | ||
| 6378 | skip(';'); | 6381 | skip(';'); |
| 6379 | break; | 6382 | break; |
| 6380 | } | 6383 | } |
| @@ -6383,6 +6386,7 @@ static int decl0(int l, int is_for_loop_init) · 2 unmodified lines | |||
| 6383 | ad.a.aligned = 0; | 6386 | ad.a.aligned = 0; |
| 6384 | } | 6387 | } |
| 6385 | } | 6388 | } |
| 6389 | tcc_free(asm_label); | ||
| 6386 | return 0; | 6390 | return 0; |
| 6387 | } | 6391 | } |
| 6388 | 6392 | ||