[RFC] Assert DECL_ABSTRACT_ORIGIN is different from the decl itself

Martin Jambor mjambor@suse.cz
Thu Dec 1 16:10:00 GMT 2016


Hello,

On Wed, Nov 30, 2016 at 02:09:19PM +0100, Martin Jambor wrote:
> On Tue, Nov 29, 2016 at 10:17:02AM -0700, Jeff Law wrote:
> >
> > ...
> >
> > So it seems that rather than an assert that we should just not walk down a
> > self-referencing DECL_ABSTRACT_ORIGIN.
> > 
> 
> ...
> 
> So I wonder what the options are... perhaps it seems that we can call
> dump_function_name which starts with code handling
> !DECL_LANG_SPECIFIC(t) cases, even instead of the weird <built-in>
> thing?

The following patch does that, it works as expected on my small
testcases, brings g++ in line with what gcc does with clones when it
comes to OpenMP outline functions and obviously prevents the infinite
recursion.

It passes bootstrap and testing on x86_64-linux.  OK for trunk?

Thanks,


2016-11-30  Martin Jambor  <mjambor@suse.cz>

	PR c++/78589
	* error.c (dump_decl): Use dump_function_name to dump
	!DECL_LANG_SPECIFIC function decls with no or self-referencing
	abstract origin.
---
 gcc/cp/error.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 7bf07c3..5f8fb2a 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1216,10 +1216,11 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
     case FUNCTION_DECL:
       if (! DECL_LANG_SPECIFIC (t))
 	{
-	  if (DECL_ABSTRACT_ORIGIN (t))
+	  if (DECL_ABSTRACT_ORIGIN (t)
+	      && DECL_ABSTRACT_ORIGIN (t) != t)
 	    dump_decl (pp, DECL_ABSTRACT_ORIGIN (t), flags);
 	  else
-	    pp_string (pp, M_("<built-in>"));
+	    dump_function_name (pp, t, flags);
 	}
       else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
 	dump_global_iord (pp, t);
-- 
2.10.2




More information about the Gcc-patches mailing list