How to avoid constant propagation into functions?

Georg-Johann Lay avr@gjlay.de
Mon Dec 5 16:05:00 GMT 2016


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



More information about the Gcc-help mailing list