http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60761
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- 4.8 prints t.ii: In function ‘void _Z3fooi.constprop.0()’: t.ii:14:8: warning: array subscript is above array bounds [-Warray-bounds] z[i] = i; ^ which isn't perfect either. Is there a way for the C++ FE to get at the original function decl that was cloned? Like with Index: gcc/cp/error.c =================================================================== --- gcc/cp/error.c (revision 209210) +++ gcc/cp/error.c (working copy) @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. #include "pointer-set.h" #include "c-family/c-objc.h" #include "ubsan.h" +#include "cgraph.h" #include <new> // For placement-new. @@ -1145,7 +1146,17 @@ dump_decl (cxx_pretty_printer *pp, tree case FUNCTION_DECL: if (! DECL_LANG_SPECIFIC (t)) - pp_string (pp, M_("<built-in>")); + { + cgraph_node *node; + if ((node = cgraph_get_node (t)) + && node->former_clone_of) + { + dump_decl (pp, node->former_clone_of, flags); + pp_string (pp, M_(" <clone>")); + } + else + pp_string (pp, M_("<built-in>")); + } else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) dump_global_iord (pp, t); else which prints t.ii: In function 'void foo(int) <clone>': t.ii:14:13: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations] z[i] = i; ^ t.ii:13:3: note: containing loop for (int i = 0; i < s; i++) ^ t.ii:14:8: warning: array subscript is above array bounds [-Warray-bounds] z[i] = i; ^ does former_clone_of apply recursively? Thus can we have a clone of a clone? Is there a way to "pretty-print" the kind of clone? That is, say <clone with foo = 1> for a ipa-cp clone with parameter foo replaced by 1?