test3 wasn't working originally.
Unified · Split
| @@ -1,5 +1,4 @@ | ||
| 1 | −#include <tcclib.h> | |
| 2 | − | |
| 1 | +extern int printf(const char*, ...); | |
| 3 | 2 | static int glob_i = 0; |
| 4 | 3 | |
| 5 | 4 | void incr_glob_i(int *i) |
| @@ -115,6 +114,41 @@ void test_ret2() · 109 unmodified lines | ||
| 115 | 114 | } |
| 116 | 115 | } |
| 117 | 116 | |
| 117 | +void test2(void) { | |
| 118 | + int chk = 0; | |
| 119 | +again: | |
| 120 | + if (!chk) { | |
| 121 | + char * __attribute__ ((cleanup(check2))) stop_that = "test2"; | |
| 122 | + chk++; | |
| 123 | + goto again; | |
| 124 | + } | |
| 125 | +} | |
| 126 | + | |
| 127 | +int test3(void) { | |
| 128 | + char * __attribute__ ((cleanup(check2))) stop_that = "three"; | |
| 129 | + int chk = 0; | |
| 130 | + | |
| 131 | + if (chk) { | |
| 132 | + { | |
| 133 | + outside: | |
| 134 | + { | |
| 135 | + char * __attribute__ ((cleanup(check2))) stop_that = "two"; | |
| 136 | + printf("---- %d\n", chk); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + } | |
| 140 | + if (!chk) | |
| 141 | + { | |
| 142 | + char * __attribute__ ((cleanup(check2))) stop_that = "one"; | |
| 143 | + | |
| 144 | + if (!chk) { | |
| 145 | + chk = 1; | |
| 146 | + goto outside; | |
| 147 | + } | |
| 148 | + } | |
| 149 | + return 0; | |
| 150 | +} | |
| 151 | + | |
| 118 | 152 | int main() |
| 119 | 153 | { |
| 120 | 154 | int i __attribute__ ((__cleanup__(check))) = 0, not_i; |
| @@ -138,6 +172,8 @@ int main() · 17 unmodified lines | ||
| 138 | 172 | printf("because what if free was call inside cleanup function\n", test()); |
| 139 | 173 | test_ret(); |
| 140 | 174 | test_ret2(); |
| 175 | + test2(); | |
| 176 | + test3(); | |
| 141 | 177 | return i; |
| 142 | 178 | } |
| 143 | 179 | |
| @@ -10,6 +10,11 @@ str: that · 9 unmodified lines | ||
| 10 | 10 | str: this should appear only once |
| 11 | 11 | str: -that2 |
| 12 | 12 | str: -that |
| 13 | +str: test2 | |
| 14 | +str: one | |
| 15 | +---- 1 | |
| 16 | +str: two | |
| 17 | +str: three | |
| 13 | 18 | ---- 0 |
| 14 | 19 | ---- 1 |
| 15 | 20 | str: plop |