aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr25923.f9024
-rw-r--r--gcc/toplev.c3
-rw-r--r--gcc/tree-pass.h3
-rw-r--r--gcc/tree-pretty-print.c10
7 files changed, 53 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8871826..e744b9f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 0be0d75f..13d93b0 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6a69bff..e0cb3dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/pr25923.f90 b/gcc/testsuite/gfortran.dg/pr25923.f90
new file mode 100644
index 0000000..5a2ee29
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr25923.f90
@@ -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
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 8a471d8..1600596 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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;
}
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 1b92f8c..c22e15e 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -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);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index ab637a8..32f8ac0 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -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;
}