History

VLA leaks vstack. added warning to detect future leaks

Joe Soroka committed 15 years ago

Commit 6eb97c71 parent c94f8051 file · +4 −0Browse files

Unified · Split

libtcc.c+4−0
@@ -689,6 +689,7 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename) · 688 unmodified lines
689689 static int tcc_compile(TCCState *s1)
690690 {
691691 Sym *define_start;
692+ SValue *pvtop;
692693 char buf[512];
693694 volatile int section_sym;
694695
@@ -758,6 +759,7 @@ static int tcc_compile(TCCState *s1) · 63 unmodified lines
758759
759760 define_start = define_stack;
760761 nocode_wanted = 1;
762+ pvtop = vtop;
761763
762764 if (setjmp(s1->error_jmp_buf) == 0) {
763765 s1->nb_errors = 0;
@@ -787,6 +789,8 @@ static int tcc_compile(TCCState *s1) · 23 unmodified lines
787789
788790 sym_pop(&global_stack, NULL);
789791 sym_pop(&local_stack, NULL);
792+ if (pvtop != vtop)
793+ warning("internal compiler error: vstack leak? (%d)", vtop - pvtop);
790794
791795 return s1->nb_errors != 0 ? -1 : 0;
792796 }

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