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

            Bug ID: 71991
           Summary: Inconsistency for __attribute__ ((__always_inline__))
                    among LTO and non-LTO compilation
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Hello.

As mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=77580#c6, we
behave differently in case of LTO and non-LTO build for the following code
snippet:

$ cat tc.i
static __attribute__ ((__always_inline__)) int fn1 () { return 0; }
static __attribute__ ((target ("inline-all-stringops"))) int fn2 () { fn1 (); }

int main()
{
  fn2();
}

$ gcc -O2 tc.i
tc.i:1:48: warning: always_inline function might not be inlinable
[-Wattributes]
 static __attribute__ ((__always_inline__)) int fn1 () { return 0; }

$ gcc -O2 tc.i -flto
tc.i:1:48: warning: always_inline function might not be inlinable
[-Wattributes]
 static __attribute__ ((__always_inline__)) int fn1 () { return 0; }
                                                ^~~
tc.i: In function ‘fn2’:
tc.i:1:48: error: inlining failed in call to always_inline ‘fn1’: target
specific option mismatch
tc.i:2:71: note: called from here
 static __attribute__ ((target ("inline-all-stringops"))) int fn2 () { fn1 ();
}
                                                                       ^~~~~~

Reply via email to