This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Error detection fix for read-rtl.c
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Apr 2010 12:59:43 +0200
- Subject: Re: Error detection fix for read-rtl.c
- References: <Pine.LNX.4.64.1004012320030.13428@digraph.polyomino.org.uk>
On Fri, Apr 2, 2010 at 1:20 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> I encountered a case where a mistake in a .md file caused genmddeps to
> spin in a loop at EOF until it ran out of memory. ?This patch adds a
> check for EOF in the relevant loop. ?Bootstrapped with no regressions
> on x86_64-unknown-linux-gnu. ?OK to commit?
Ok.
Thanks,
Richard.
> 2010-04-01 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?* read-rtl.c (read_rtx_1): Give an error for EOF while looking for
> ? ? ? ?']'.
>
> Index: read-rtl.c
> ===================================================================
> --- read-rtl.c ?(revision 157794)
> +++ read-rtl.c ?(working copy)
> @@ -1595,6 +1595,8 @@ read_rtx_1 (FILE *infile, struct map_val
> ? ? ? ? ?obstack_init (&vector_stack);
> ? ? ? ? ?while ((c = read_skip_spaces (infile)) && c != ']')
> ? ? ? ? ? ?{
> + ? ? ? ? ? ? if (c == EOF)
> + ? ? ? ? ? ? ? fatal_expected_char (infile, ']', c);;
> ? ? ? ? ? ? ?ungetc (c, infile);
> ? ? ? ? ? ? ?list_counter++;
> ? ? ? ? ? ? ?obstack_ptr_grow (&vector_stack, read_rtx_1 (infile, mode_maps));
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>