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

            Bug ID: 105727
           Summary: __builtin_constant_p expansion in LTO
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

It's basically follow-up of PR101941 which I noticed during the building of
Linux with LTO w/ KASAN enabled:

$ cat a.c
void memory_is_poisoned(int size) {
  if (__builtin_constant_p(size)) __builtin_abort();
}

$ cat b.c
void memory_is_poisoned(int size);

int main(int argc, char **argv) {
  memory_is_poisoned(128);
  return 0;
}

$ gcc [ab].c -O2 && ./a.out
$ clang [ab].c -flto -O2 && ./a.out
$ gcc [ab].c -flto -O2 && ./a.out
Aborted (core dumped)

Reply via email to