This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] RE: genautomata.c bug


: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....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]