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