https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120478
--- Comment #1 from Wentao Zhang <wentaoz5 at illinois dot edu> ---
Another reduced input from lzo2:
__inline__ __attribute__((__always_inline__))
int foo(int x) { return 0; }
int main(void) {
int a = 0, b = 0;
for (int i = 0; i < 42; i++) {
foo(a+1) + foo(1);
a++;
}
}
Report:
-: 1:__inline__ __attribute__((__always_inline__))
84: 2:int foo(int x) { return 0; }
-: 3:
1: 4:int main(void) {
1: 5: int a = 0, b = 0;
43: 6: for (int i = 0; i < 42; i++) {
84: 7: foo(a+1) + foo(1);
42: 8: a++;
-: 9: }
-: 10:}
(1) inline is again one of the triggering conditions
(2) argument to the first call has to be somewhat complex, e.g. variable or
constant alone reverts the behavior
(3) commenting or uncommenting the statement that follows switches between
two behaviors that are both not straightforward
1: 4:int main(void) {
1: 5: int a = 0, b = 0;
43: 6: for (int i = 0; i < 42; i++) {
126: 7: foo(a+1) + foo(1);
-: 8: // a++;
-: 9: }
-: 10:}