This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] RE: genautomata.c bug
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Thomas Neumann'" <tneumann at users dot sourceforge dot net>
- Cc: "'Aaron Gray'" <angray at beeb dot net>, <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 May 2007 13:40:42 +0100
- Subject: [PATCH] RE: genautomata.c bug
- References: <1ec701c794c0$1161eb10$0200a8c0@AMD2500> <06bd01c7961b$93b95ab0$2e08a8c0@CAM.ARTIMI.COM> <46485652.6080105@users.sourceforge.net>
:ADDPATCH machine description generators:
On 14 May 2007 13:30, Thomas Neumann wrote:
> [I accidentally did not CC you...]
>
> Dave Korn schrieb:
>> Looks like you're right to me. We get away with it because a decl is
>> larger than a regexp. Testing a patch now.
> this is fixed by my patch
>
> http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00814.html
>
> which is not reviewed yet. The patch switches to typesafe memory
> allocation, which uncovered the bug.
:) I did notice your patch going past the other day, but I thought until
that gets approved it would be worthwhile checking in a fix. My bootstrap has
now finished (regtesting now), I may as well throw this into the mix.
2007-05-14 Dave Korn <dave.korn@artimi.com>
* genautomata.c (gen_regexp_el): Allocate correct size for regexp.
Index: genautomata.c
===================================================================
--- genautomata.c (revision 124708)
+++ genautomata.c (working copy)
@@ -1542,12 +1542,12 @@
}
else if (strcmp (str, NOTHING_NAME) == 0)
{
- regexp = create_node (sizeof (struct decl));
+ regexp = create_node (sizeof *regexp);
regexp->mode = rm_nothing;
}
else
{
- regexp = create_node (sizeof (struct decl));
+ regexp = create_node (sizeof *regexp);
regexp->mode = rm_unit;
REGEXP_UNIT (regexp)->name = str;
}
cheers,
DaveK
--
Can't think of a witty .sigline today....