Patch fixing a rare genautomata bug

Vladimir Makarov vmakarov@redhat.com
Tue Apr 29 23:09:00 GMT 2003


Vladimir Makarov wrote:
> 
> I've run into a rare genautomata bug.  An undefined value used for
> table could bigger than maximal table element value.  The type of
> elements is defined from the maximal element value.  So the undefined
> value can be truncated if it is out of range of table element type.
> 
> The following patch fixes the problem. The patch is very safe. It has
> been tested on regression tests and bootstrap for x86 and ia64.
> 
> I've just committed the patch into the main line.
> 
> Vlad
> 
> 2003-04-29  Vladimir Makarov  <vmakarov@redhat.com>
> 
>         * genautomata.c (add_vect): Check undefined value for range type
>         too.
> 

Sorry, that was a wrong patch.  Here is the correct one.
-------------- next part --------------
Index: genautomata.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genautomata.c,v
retrieving revision 1.40
diff -c -p -r1.40 genautomata.c
*** genautomata.c	14 Apr 2003 15:50:08 -0000	1.40
--- genautomata.c	29 Apr 2003 22:44:33 -0000
*************** add_vect (tab, vect_num, vect, vect_leng
*** 7885,7890 ****
--- 7885,7894 ----
            tab->min_comb_vect_el_value = vect [vect_index];
          check_vect_start [comb_vect_index + vect_index] = vect_num;
        }
+   if (tab->max_comb_vect_el_value < undefined_vect_el_value)
+     tab->max_comb_vect_el_value = undefined_vect_el_value;
+   if (tab->min_comb_vect_el_value > undefined_vect_el_value)
+     tab->min_comb_vect_el_value = undefined_vect_el_value;
    if (tab->max_base_vect_el_value < comb_vect_index)
      tab->max_base_vect_el_value = comb_vect_index;
    if (tab->min_base_vect_el_value > comb_vect_index)


More information about the Gcc-patches mailing list