https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112947

--- Comment #4 from resence at parsoma dot net ---
Or rather,

static int *nimErrorFlag(void) {
  /* With this, no always-false warning */
  /* printf("BAR1: %p\n", (void*)&nimInErrorMode__system_u4299); */

  if (((&nimInErrorMode__system_u4299) == (void *)0)) {
    write(1, "Always-false comparison is true\n", 32);
    printf("FOO: %p\n", (void*)&nimInErrorMode__system_u4299);
  }

  int *result = (&nimInErrorMode__system_u4299);
  printf("BAR2: %p\n", (void*)&nimInErrorMode__system_u4299);
  printf("BAR3: %p\n", (void*)result);

  return result;
}

resulting in
BAR2: 0x7f9ee746773c
BAR3: 0x7f9ee746773c
BAR2: 0x7f9ee746773c
BAR3: 0x7f9ee746773c
Always-false comparison is true
FOO: (nil)
BAR2: 0x7f9ee746773c
BAR3: 0x7f9ee746773c

(adding BAR4/BAR5 change behavior again).

Reply via email to