This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/18259] New: -fdump-tree-original omits real constant values
- From: "dspeyer at wam dot umd dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Oct 2004 22:46:40 -0000
- Subject: [Bug debug/18259] New: -fdump-tree-original omits real constant values
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
A command of the form:
g++ -c -fdump-tree-original foo.cc
produces a file foo.cc.original which contains a nearly-complete parse tree.
The parse tree in question does *not* contain the values of real constants.
This makes the tree inadequate for any program which tries to analyse the tree.
Here is a patch:
--- /home/gui/gcc-3.4.2-old/gcc/tree-dump.c 2003-12-18 15:09:40.000000000 -0500
+++ /home/gui/gcc-3.4.2/gcc/tree-dump.c 2004-10-31 17:17:23.000000000 -0500
@@ -176,6 +176,19 @@
di->column += 14;
}
+/* Dump real number R using FIELD to identify it. */
+
+void
+dump_real (dump_info_p di, const char *field, const REAL_VALUE_TYPE *r)
+{
+ char buf[16];
+ real_to_decimal(buf, r, sizeof(buf), 0, TRUE);
+ dump_maybe_newline (di);
+ di->column +=
+ fprintf (di->stream, "%-4s: %s ", field, buf);
+}
+
+
/* Dump the string S. */
void
@@ -509,6 +522,11 @@
dump_int (di, "lngt", TREE_STRING_LENGTH (t));
break;
+
+ case REAL_CST:
+ dump_real (di, "valu", TREE_REAL_CST_PTR (t));
+ break;
+
case TRUTH_NOT_EXPR:
case ADDR_EXPR:
case INDIRECT_REF:
--- /home/gui/gcc-3.4.2-old/gcc/tree-dump.h 2003-06-08 10:21:54.000000000 -0400
+++ /home/gui/gcc-3.4.2/gcc/tree-dump.h 2004-10-31 17:17:34.000000000 -0500
@@ -22,6 +22,8 @@
#ifndef GCC_TREE_DUMP_H
#define GCC_TREE_DUMP_H
+#include "real.h"
+
/* Flags used with queue functions. */
#define DUMP_NONE 0
#define DUMP_BINFO 1
@@ -79,6 +81,7 @@
extern void dump_pointer (dump_info_p, const char *, void *);
extern void dump_int (dump_info_p, const char *, int);
+extern void dump_real (dump_info_p, const char *, const REAL_VALUE_TYPE *);
extern void dump_string (dump_info_p, const char *);
extern void dump_stmt (dump_info_p, tree);
extern void dump_next_stmt (dump_info_p, tree);
--
Summary: -fdump-tree-original omits real constant values
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dspeyer at wam dot umd dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: same
GCC host triplet: Linux 2.4.20 / i686 / GLIBC 2.3.2
GCC target triplet: same
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18259