Hi! This got fixed by r251220. Testcase tested on x86_64-linux, trunk as well as r251218 (where it FAILs), committed to trunk as obvious.
2017-12-14 Jakub Jelinek <ja...@redhat.com> PR lto/81406 * gcc.dg/lto/pr81406_0.c: New test. --- gcc/testsuite/gcc.dg/lto/pr81406_0.c.jj 2017-12-14 16:20:44.867849609 +0100 +++ gcc/testsuite/gcc.dg/lto/pr81406_0.c 2017-12-14 16:17:34.000000000 +0100 @@ -0,0 +1,20 @@ +/* PR lto/81406 */ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -g -flto } } } */ +/* { dg-extra-ld-options { -g -r -nostdlib } } */ + +int a; +int *foo (void); + +static inline int __attribute__ ((__artificial__)) +bar (void) +{ + if (a) + *foo () = 2; +} + +void * +baz (void) +{ + return (void *) bar; +} Jakub