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]

[PATCH, i386]: Fix PR target/31854.c


Hello!

Attached patch fixes PR target/31854, internal compiler error: in cgraph_local_info, at cgraph.c:618. The problem is in ix86_function_regparm(), when TREE_CODE (decl) equals IDENTIFIER_NODE. Attached patch tightens the condition, so that local functions get processed only when TREE_CODE (decl) == FUNCTION_DECL (otherwise we ICE in cgraph_local_info().

The path to ICE goes from ix86_return_pops_args(), where TDmode values trigger aggregate_value_p() check. In 32bit mode, we force TDmode values to memory via return_in_memory_32 function.

Attached patch was bootstrapped on i686-pc-linux-gnu and x86_64-pc-linux-gnu. The patch was regression tested on x86_64-pc-linux-gnu with and without -m32. If there are no objections, I'll commit this patch to SVN tomorrow.

2007-05-07 Uros Bizjak <ubizjak@gmail.com>

       PR target/31854
       * config/i386/i386.c (ix86_function_regparm): Only process local
       functions when TREE_CODE (decl) equals FUNCTION_DECL.

testsuite/ChangeLog:

2007-05-07 Uros Bizjak <ubizjak@gmail.com>

       PR target/31854
       * gcc.target/i386/pr31854.c: New test.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 124499)
+++ config/i386/i386.c	(working copy)
@@ -2792,7 +2792,8 @@
     return 2;
 
   /* Use register calling convention for local functions when possible.  */
-  if (decl && flag_unit_at_a_time && !profile_flag)
+  if (decl && TREE_CODE (decl) == FUNCTION_DECL
+      && flag_unit_at_a_time && !profile_flag)
     {
       struct cgraph_local_info *i = cgraph_local_info (decl);
       if (i && i->local)
Index: testsuite/gcc.target/i386/pr31854.c
===================================================================
--- testsuite/gcc.target/i386/pr31854.c	(revision 0)
+++ testsuite/gcc.target/i386/pr31854.c	(revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile { target dfp } } */
+/* { dg-options "-O -std=gnu99" } */
+
+_Decimal128 d128;
+long double tf;
+
+void foo (void)
+{
+  d128 = tf;
+}

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