This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix reversed gcc_assert in copy_constant


gcc.c-torture/compile/20050113-1.c hangs for -mips32 hosts because an
assertion was accidentally inverted during the gcc_assert() conversion.
copy_constant now reads:

static tree
copy_constant (tree exp)
{
  switch (TREE_CODE (exp))
    {
    ...
    default:
      {
	tree t = lang_hooks.expand_constant (exp);

	gcc_assert (t == exp);
	return copy_constant (t);
      }
    }
}

which is trivially infinite.  This is presumably a regression for
languages whose expand_constant actually does something.  It's also
a regression in the MIPS case because an ICE has turned into
non-termination, which is surely worse.

I'll look at fixing the ICE when I find time.  Until then,
I've applied this patch as obvious after testing on mipsisa64-elf.
What used to be timeout failures have turned into ICE failures.

Richard


gcc/
	* varasm.c (copy_constant): Fix reversed gcc_assert check.


Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 117059)
+++ gcc/varasm.c	(working copy)
@@ -2749,7 +2749,7 @@ copy_constant (tree exp)
       {
 	tree t = lang_hooks.expand_constant (exp);
 
-	gcc_assert (t == exp);
+	gcc_assert (t != exp);
 	return copy_constant (t);
       }
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]