re PR middle-end/25923 ([gfortran] garbled diagnostics with -O -Wuninitialized)

2007-04-24  Simon Martin  <simartin@users.sourceforge.net>

	PR diagnostic/25923
	* tree-pass.h (TDF_DIAGNOSTIC): New dump control to specify that a
	diagnostic message is being built.
	* tree-pretty-print.c (dump_generic_node): Only write the formatted text
	into BUFFER's stream if we are not building a diagnostic message.
	* toplev.c (default_tree_printer): Pass TDF_DIAGNOSTIC to
	dump_generic_node.
	* Makefile.in (toplev.o): Depend on tree-pass.h.

From-SVN: r124121
This commit is contained in:
Simon Martin 2007-04-24 20:52:16 +00:00 committed by Simon Martin
parent 4df28528f6
commit 438d798f12
7 changed files with 53 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2007-04-24 Simon Martin <simartin@users.sourceforge.net>
PR diagnostic/25923
* tree-pass.h (TDF_DIAGNOSTIC): New dump control to specify that a
diagnostic message is being built.
* tree-pretty-print.c (dump_generic_node): Only write the formatted text
into BUFFER's stream if we are not building a diagnostic message.
* toplev.c (default_tree_printer): Pass TDF_DIAGNOSTIC to
dump_generic_node.
* Makefile.in (toplev.o): Depend on tree-pass.h.
2007-04-24 Ian Lance Taylor <iant@google.com>
PR tree-optimization/31602

View File

@ -2227,7 +2227,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
value-prof.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \
$(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \
$(CPPLIB_H) opts.h params.def tree-mudflap.h $(REAL_H)
$(CPPLIB_H) opts.h params.def tree-mudflap.h $(REAL_H) tree-pass.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DTARGET_NAME=\"$(target_noncanonical)\" \
-c $(srcdir)/toplev.c $(OUTPUT_OPTION)

View File

@ -1,3 +1,8 @@
2007-04-24 Simon Martin <simartin@users.sourceforge.net>
PR diagnostic/25923
* gfortran.dg/pr25923.f90: New test.
2007-04-24 Ian Lance Taylor <iant@google.com>
PR tree-optimization/31602

View File

@ -0,0 +1,24 @@
! { dg-do compile }
! { dg-options "-O -Wuninitialized" }
module foo
implicit none
type bar
integer :: yr
end type
contains
function baz(arg) result(res) ! { dg-warning "res.yr' may be" }
type(bar), intent(in) :: arg
type(bar) :: res
logical, external:: some_func
if (.not. some_func(arg)) then
call fatal('arg not valid')
else
res = arg
end if
end function baz
end module foo

View File

@ -82,6 +82,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "value-prof.h"
#include "alloc-pool.h"
#include "tree-mudflap.h"
#include "tree-pass.h"
#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
#include "dwarf2out.h"
@ -1567,7 +1568,7 @@ default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
pp_string (pp, n);
}
else
dump_generic_node (pp, t, 0, 0, 0);
dump_generic_node (pp, t, 0, TDF_DIAGNOSTIC, 0);
return true;
}

View File

@ -71,6 +71,9 @@ enum tree_dump_index
#define TDF_MEMSYMS (1 << 14) /* display memory symbols in expr.
Implies TDF_VOPS. */
#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic
message. */
extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);
extern int dump_initialized_p (enum tree_dump_index);

View File

@ -431,8 +431,8 @@ dump_symbols (pretty_printer *buffer, bitmap syms, int flags)
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
FLAGS specifies details to show in the dump (see TDF_* in tree.h). If
IS_STMT is true, the object printed is considered to be a statement
FLAGS specifies details to show in the dump (see TDF_* in tree-pass.h).
If IS_STMT is true, the object printed is considered to be a statement
and it is terminated by ';' if appropriate. */
int
@ -2055,7 +2055,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (is_stmt && is_expr)
pp_semicolon (buffer);
pp_write_text_to_stream (buffer);
/* If we're building a diagnostic, the formatted text will be written
into BUFFER's stream by the caller; otherwise, write it now. */
if (!(flags & TDF_DIAGNOSTIC))
pp_write_text_to_stream (buffer);
return spc;
}