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 PR31847: Printing to dump file broken


Hi all.

The patch that I have submitted to fix PR25923 and that was approved for the 
mainline (see http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01388.html and 
http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01603.html) broke some tree 
dumps, in particular PRE.

The problem is that when one uses for instance "-fdump-tree-pre-all", the 
flags that are used are
   ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA |
     TDF_STMTADDR | TDF_GRAPH)
i.e. "contain" TDF_DIAGNOSTIC, the flag that was introduced to fix PR25923, 
that specifies that a diagnostic message is being built, and that the string 
constructed by 'print_generic_expr' must not be directly written into the 
output stream.

This causes us to output, for instance,
  Created value  for
  VH.8scD.1643_1(D)
instead of
  Created value VH.8 for scD.1643_1(D)

The attached patch fixes this by adjusting the flags used for "*-all" tree 
dumps.

I have successfully regtested C, C++, Fortran and Java on i686-pc-linux-gnu. 
Is it OK?

Sorry for the breakage.

Best regards,
Simon

:ADDPATCH diagnostic:
2007-05-07  Simon Martin  <simartin@users.sourceforge.net>

	PR 31847
	* tree-dump.c (dump_options): Don't use TDF_DIAGNOSTIC in "*-all" tree
	dumps.
Index: gcc/tree-dump.c
===================================================================
--- gcc/tree-dump.c	(revision 124510)
+++ gcc/tree-dump.c	(working copy)
@@ -803,7 +803,7 @@ static const struct dump_option_value_in
   {"stmtaddr", TDF_STMTADDR},
   {"memsyms", TDF_MEMSYMS},
   {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA 
-	    | TDF_STMTADDR | TDF_GRAPH)},
+	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC)},
   {NULL, 0}
 };
 
2007-05-07  Simon Martin  <simartin@users.sourceforge.net>

	PR 31847
	* gcc.dg/pr31847.c: New test.
/* PR 31847 */

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre-all" } */

extern int bar(int);

int foo()
{
  int a = 0;
  return bar(a);
}

/* { dg-final { scan-tree-dump-not "Created value  for " "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */

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