This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to avoid constant propagation into functions?
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 5 Dec 2016 17:05:23 +0100
- Subject: How to avoid constant propagation into functions?
- Authentication-results: sourceware.org; auth=none
Hi, I just came across a small test program that propagates a constant
value from a function to a callee, even though the callee has attribute
"noclone".
From the gcc documentation I would conclude that "noclone" should
prevent such propagations?
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bnoclone_007d-function-attribute-3345
noclone
This function attribute prevents a function from being
considered for cloning -- a mechanism that produces specialized
copies of functions and which is (currently) performed by
interprocedural constant propagation.
I see this with gcc 5.4 (x86_64) and current trunk.
Johann