https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110129
--- Comment #2 from Haoxin Tu <haoxintu at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
Oops, my bad. Thank you for pointing this out. I didn't notice the front-end is
C++ in GodBolt.

I have another similar case, can you take a look, please?

```
#include <stdint.h>
#include <stdio.h>
struct {
  int32_t a;
} b;
int8_t c;
int ids = 0;
void __attribute__((noinline)) marker_1() {
    printf(" b%db ", 1);
    ids++;
}
uint8_t d(int8_t e) {
    b.a = 0;
f:
  for (; e < 8;) {
    for (; e;)
      ;
    goto f;
  }
  return b.a;
}
int main() {
  int32_t g[1] = {0};
  if (d(c), g)
    marker_1();
  printf("%d\n", ids);
}

```


$gcc-trunk -w -O3 s.c ; ./a.out
(hang)
$clang-trunk -w -O3 s.c ; ./a.out
b1b 1

Godbolt link: https://godbolt.org/z/Kn6cv3hjf

GCC hangs on it while Clang can successfully run it. From my understanding, the
goto-statement in function d should not be executed but it seems GCC does. Did
I miss anything here? Thanks!

Reply via email to