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] Fix PR c/6809


Hi!

The following testcase ICEs on IA-32.
The problem is that print_mem_expr doesn't know about unnamed fields.
I think best is to not print anything for them, so that e.g. in the
testcase below <variable>.a etc. is printed (as opposed to e.g.
<variable>..a or <variable>.<unnamed>.a).
Fix below, ok to commit? 3.1.1 as well (regression from 3.0.x)?

2002-05-30  Jakub Jelinek  <jakub@redhat.com>

	PR c/6809
	* print-rtl.c (print_mem_expr): Don't crash on unnamed fields.

	* gcc.dg/20020530-1.c: New test.

--- gcc/testsuite/gcc.dg/20020530-1.c.jj	Thu May 30 15:35:27 2002
+++ gcc/testsuite/gcc.dg/20020530-1.c	Thu May 30 15:36:30 2002
@@ -0,0 +1,20 @@
+/* PR c/6809
+   Test -fverbose-asm with unnamed fields.  */
+/* { dg-do compile } */
+/* { dg-options "-fverbose-asm" } */
+
+typedef union U
+{
+  struct
+  {
+    unsigned int a;
+    int b;
+  };
+  long long c;
+} *T;
+
+int foo (T x)
+{
+  int r = x->a + x->b;
+  return r;
+}
--- gcc/print-rtl.c.jj	Tue Dec  4 11:21:28 2001
+++ gcc/print-rtl.c	Thu May 30 15:21:43 2002
@@ -88,8 +88,9 @@ print_mem_expr (outfile, expr)
         print_mem_expr (outfile, TREE_OPERAND (expr, 0));
       else
 	fputs (" <variable>", outfile);
-      fprintf (outfile, ".%s",
-	       IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (expr, 1))));
+      if (DECL_NAME (TREE_OPERAND (expr, 1)))
+	fprintf (outfile, ".%s",
+		 IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (expr, 1))));
     }
   else if (DECL_NAME (expr))
     fprintf (outfile, " %s", IDENTIFIER_POINTER (DECL_NAME (expr)));

	Jakub


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