This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
bus error in gengtype
- From: Richard Henderson <rth at redhat dot com>
- To: geoffk at geoffk dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Apr 2005 09:54:34 -0700
- Subject: bus error in gengtype
I'm a bit lost here.
(gdb) where
#0 0x00000001200074fc in write_func_for_structure (orig_s=0x120036550,
s=0x120036550, param=0x0, wtd=0x120017300)
at /home/rth/work/gcc/src-gcc/gcc/gengtype.c:2079
#1 0x0000000120007ba0 in write_types (structures=0x1200bab80,
param_structs=0x1200270d0, wtd=0x120017300)
at /home/rth/work/gcc/src-gcc/gcc/gengtype.c:2221
#2 0x000000012000a3ec in main (argc=1, argv=0x11ffb5ac8)
at /home/rth/work/gcc/src-gcc/gcc/gengtype.c:3083
2079 if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
2080 && orig_s->u.p->u.s.line.file != NULL)
(gdb) p *orig_s
$5 = {kind = TYPE_STRUCT, next = 0x120036260, pointer_to = 0x1200365e0,
gc_used = GC_POINTED_TO, u = {p = 0x120015ee2, s = {
tag = 0x120015ee2 "basic_block_def", line = {
file = 0x1200142e4 "/home/rth/work/gcc/src-gcc/gcc/basic-block.h",
line = 269}, fields = 0x1200607b0, opt = 0x12005f360, bitmap = 31,
lang_struct = 0x0}, sc = 0x120015ee2 "basic_block_def", a = {
p = 0x120015ee2,
len = 0x1200142e4 "/home/rth/work/gcc/src-gcc/gcc/basic-block.h"},
param_struct = {stru = 0x120015ee2, param = {0x1200142e4, 0x10d,
0x1200607b0, 0x12005f360, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0}, line = {
file = 0x0, line = 0}}}}
Note orig_s->u.p->kind is dereferencing readable ascii. The member
that appears to be valid is orig_s->u.s.
My guess is that this is a simple typo, fixed like so. Correct?
r~
* gengtype.c (write_func_for_structure): Remove extra indirection
dealing with TYPE_PARAM_STRUCT.
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.72
diff -u -p -d -r1.72 gengtype.c
--- gengtype.c 13 Mar 2005 18:09:53 -0000 1.72
+++ gengtype.c 21 Apr 2005 16:52:44 -0000
@@ -2076,8 +2076,8 @@ write_func_for_structure (type_p orig_s,
oprintf (d.of, ", xlimit, gt_%s_", wtd->param_prefix);
output_mangled_typename (d.of, orig_s);
- if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
- && orig_s->u.p->u.s.line.file != NULL)
+ if (orig_s->kind == TYPE_PARAM_STRUCT
+ && orig_s->u.s.line.file != NULL)
{
oprintf (d.of, ", gt_e_");
output_mangled_typename (d.of, orig_s);
@@ -2116,8 +2116,8 @@ write_func_for_structure (type_p orig_s,
oprintf (d.of, ", xprev, gt_%s_", wtd->param_prefix);
output_mangled_typename (d.of, orig_s);
- if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
- && orig_s->u.p->u.s.line.file != NULL)
+ if (orig_s->kind == TYPE_PARAM_STRUCT
+ && orig_s->u.s.line.file != NULL)
{
oprintf (d.of, ", gt_e_");
output_mangled_typename (d.of, orig_s);