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]

Re: [LTO][PATCH] Fix lto1 ICE in pp_base_format


Manuel López-Ibáñez wrote:
2008/11/21 Simon Baldwin <simonb@google.com>:
This patch fixes a compiler error that can occur in lto1 where a backend
diagnostic message contains a %E formatter.  Without the patch lto1 fails
at pretty-print.c:559, for example:

+/* Called during diagnostic message formatting process to print a
+ source-level entity onto BUFFER. This is a slightly extended version
+ of default_tree_printer() from toplev.c, and adds support for the '%E'
+ for error messages printed by backends. */
+

So why not extend default_tree_printer() instead of duplicating all this code?

Okay. Thanks for the response.


Attached is a revised (and much shorter) version of the patch to do just that. '%E' messages in backends being used by frontends that don't override the default tree printer in toplev.c are quite likely to be latent bugs, though perhaps currently unreachable ('%qE' in gcc/config/i386/i386.c, for example). Extending the default will cover these as well as the live bug in lto1.

--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902

This patch fixes a compiler error that can occur in lto1 where a backend
diagnostic message contains a %E formatter.  Without the patch lto1 fails
at pretty-print.c:559, for example:

  $ cat sse.cc
  typedef short v8hi __attribute__((__vector_size__(16)));
  static void func() { v8hi x, y, z; z = __builtin_ia32_paddw128(x, y); }
  $ gcc -msse2 -fwhopr -c sse.cc
  $ gcc -shared -fwhopr -o /dev/null sse.o
  ...
  In function 'func':
  in pp_base_format, at pretty-print.c:559
  Please submit a full bug report,...

lto1 fails trying to print "error: '__builtin_ia32_paddw128' needs isa
option -msse2".  With the patch in place, lto1 prints the expected message.


gcc/ChangeLog.lto
2008-11-21  Simon Baldwin  <simonb@google.com>

	* toplev.c (default_tree_printer): Add handling for %E format.


Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c	(revision 142039)
+++ gcc/toplev.c	(working copy)
@@ -1497,7 +1497,7 @@ default_pch_valid_p (const void *data_p,
 
 /* Default tree printer.   Handles declarations only.  */
 static bool
-default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
+default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
 		      int precision, bool wide, bool set_locus, bool hash)
 {
   tree t;
@@ -1508,6 +1508,15 @@ default_tree_printer (pretty_printer * p
 
   switch (*spec)
     {
+    case 'E':
+      t = va_arg (*text->args_ptr, tree);
+      if (TREE_CODE (t) == IDENTIFIER_NODE)
+	{
+	  pp_string (pp, IDENTIFIER_POINTER (t));
+	  return true;
+	}
+      break;
+
     case 'D':
       t = va_arg (*text->args_ptr, tree);
       if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))

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