This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A patch for typo in gengenrtl.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: A patch for typo in gengenrtl.c
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Mon, 12 Jun 2000 12:08:55 -0700
I believe there is a typo in gengenrtl.c. In rtl.h, we have
typedef union rtunion_def
{
...
} rtunion;
typedef struct rtx_def
{
...
rtunion fld[1];
} *rtx;
But gengenrtl.c generates:
#define obstack_alloc_rtx(n) \
((rtx) obstack_alloc (rtl_obstack, \
sizeof (struct rtx_def) \
+ ((n) - 2) * sizeof (rtunion)))
It is one element of rtunion less than used. In ggc.h, we have
#define ggc_alloc_rtx(NSLOTS) \
((struct rtx_def *) ggc_alloc (sizeof (struct rtx_def) \
+ ((NSLOTS) - 1) * sizeof (rtunion)))
Why is there a difference? Is that a typo?
Thanks.
--
H.J. Lu (hjl@gnu.org)
--
2000-06-12 H.J. Lu (hjl@gnu.org)
* gengenrtl.c (obstack_alloc_rtx): Correct the allocated size.
Index: gcc/gengenrtl.c
===================================================================
RCS file: /work/cvs/gnu/egcs/gcc/gengenrtl.c,v
retrieving revision 1.1.1.15
diff -u -p -r1.1.1.15 gengenrtl.c
--- gcc/gengenrtl.c 2000/06/09 23:38:59 1.1.1.15
+++ gcc/gengenrtl.c 2000/06/12 19:00:21
@@ -362,7 +362,7 @@ gencode ()
puts ("#define obstack_alloc_rtx(n) \\");
puts (" ((rtx) obstack_alloc (rtl_obstack, \\");
puts (" sizeof (struct rtx_def) \\");
- puts (" + ((n) - 2) * sizeof (rtunion)))\n");
+ puts (" + ((n) - 1) * sizeof (rtunion)))\n");
for (fmt = formats; *fmt != 0; fmt++)
gendef (*fmt);