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

            Bug ID: 127703
           Summary: Old regression related to always_inline, identical
                    code folding, and -Og optimization level
           Product: gcc
           Version: 12.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.lazaric.gcc at gmail dot com
  Target Milestone: ---

NB: this is plain C code, not C++

```c
#define INL inline __attribute__((__always_inline__))

INL void f(void);
INL void g(void);

void f(void) {}
void g(void) {}
```

Flags: "-Og -fipa-icf-functions"

This compiled successfully with GCC 11.5,
and fails to do so since GCC 12, to today.

Compiler diagnostic:
```
<source>: In function 'g':
<source>:6:6: error: inlining failed in call to 'always_inline' 'f': function
not considered for inlining
    6 | void f(void) {}
      |      ^
<source>:7:6: note: called from this function
    7 | void g(void) {}
      |      ^
```

Godbolt: https://godbolt.org/z/b9abY7348
  • [Bug c/127703] New: Old reg... ivan.lazaric.gcc at gmail dot com via Gcc-bugs

Reply via email to