This fixes PR60761 by dumping decl context of function clones as origin with <clone> appended instead of <built-in> that now appears after we (compared to 4.8) clear DECL_LANG_SPECIFIC.
Thus for the testcase in PR60761 we now print 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; ^ instead of t.ii: In function ‘<built-in>’: 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; ^ or with 4.8 t.ii: In function ‘void _Z3fooi.constprop.0()’: t.ii:14:8: warning: array subscript is above array bounds [-Warray-bounds] z[i] = i; ^ IMHO an improvement over both variants. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Honza - does ->former_clone_of apply recursively or do I have to loop to find the "ultimate" clone-of? Jason, is <clone> good or shall I use sth else (do we annotate in-charge vs. not in-charge constructors specially for example?). Ok? Thanks, Richard. 2014-04-08 Richard Biener <rguent...@suse.de> cp/ * error.c: Include cgraph.h (dump_decl): Print function clones as their origin plus <clone> appended instead of just <built-in>. Index: gcc/cp/error.c =================================================================== *** gcc/cp/error.c (revision 209210) --- gcc/cp/error.c (working copy) *************** along with GCC; see the file COPYING3. *** 34,39 **** --- 34,40 ---- #include "pointer-set.h" #include "c-family/c-objc.h" #include "ubsan.h" + #include "cgraph.h" #include <new> // For placement-new. *************** dump_decl (cxx_pretty_printer *pp, tree *** 1145,1151 **** case FUNCTION_DECL: if (! DECL_LANG_SPECIFIC (t)) ! pp_string (pp, M_("<built-in>")); else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) dump_global_iord (pp, t); else --- 1146,1162 ---- case FUNCTION_DECL: if (! DECL_LANG_SPECIFIC (t)) ! { ! 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