Inside dead code don't regard inline functions as being referenced.
Unified · Split
| @@ -4594,7 +4594,7 @@ ST_FUNC void unary(void) · 4593 unmodified lines | ||
| 4594 | 4594 | effect to generate code for it at the end of the |
| 4595 | 4595 | compilation unit. Inline function as always |
| 4596 | 4596 | generated in the text section. */ |
| 4597 | − if (!s->c) | |
| 4597 | + if (!s->c && !nocode_wanted) | |
| 4598 | 4598 | put_extern_sym(s, text_section, 0, 0); |
| 4599 | 4599 | r = VT_SYM | VT_CONST; |
| 4600 | 4600 | } else { |
| @@ -1170,6 +1170,11 @@ void bool_test() · 1169 unmodified lines | ||
| 1170 | 1170 | extern int undefined_function(void); |
| 1171 | 1171 | extern int defined_function(void); |
| 1172 | 1172 | |
| 1173 | +static inline void refer_to_undefined(void) | |
| 1174 | +{ | |
| 1175 | + undefined_function(); | |
| 1176 | +} | |
| 1177 | + | |
| 1173 | 1178 | void optimize_out(void) |
| 1174 | 1179 | { |
| 1175 | 1180 | int i = 0 ? undefined_function() : defined_function(); |
| @@ -1264,6 +1269,9 @@ void optimize_out(void) · 88 unmodified lines | ||
| 1264 | 1269 | else |
| 1265 | 1270 | undefined_function(); |
| 1266 | 1271 | |
| 1272 | + if (defined_function() && 0) | |
| 1273 | + refer_to_undefined(); | |
| 1274 | + | |
| 1267 | 1275 | if (1) |
| 1268 | 1276 | return; |
| 1269 | 1277 | printf ("oor:%d\n", undefined_function()); |