https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78790
Bug ID: 78790
Summary: Disable IPA-VRP for noclone functions.
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: gjl at gcc dot gnu.org
Target Milestone: ---
Even with attributes noclone + noinline, gcc propagates function arguments into
functions like with the following test case and gcc-7:
__attribute__ ((noinline,noclone))
int add (int a, int b)
{
return a + b;
}
int main (void)
{
if (1 + 2 != add (1, 2))
__builtin_abort();
return 0;
}
Compile this test case with
$ gcc -save-temps ipa-cprop.c -o ipa-cprop -O3 -flto
The dump ipa-cprop.ltrans0.s then reads (x86_64)
add:
.LFB0:
.cfi_startproc
movl $3, %eax
ret
.cfi_endproc
noclone should keep gcc from generating such "clones". One problem is that
noinlone + noclone is a common idiom writing GCC tests, and the expectation is
that no such propagations are performed (no matter if it's a "real" propagation
of values or just a propagation of ranges with IPA-VRP).
There was some discussion on the gcc mailing list about this like
https://gcc.gnu.org/ml/gcc-help/2016-12/msg00036.html
== configure ==
Target: x86_64-pc-linux-gnu
Configured with: ../../gcc.gnu.org/trunk/configure
--prefix=/local/gnu/install/gcc-7-host --enable-languages=c,c++
--enable-checking=release --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161202 (experimental) [trunk revision 227650] (GCC)