Ian Lance Taylor <ian@airs.com> writes: > This patch fixes the immediate crash, but is this the right thing to > do? Or should I always put something inside the vector, even if there > is nothing meaningful to put in there?
I found other cases where an empty vector produces a NULL pointer and leads to a later crash. So I don't think it is safe to have an empty vector in RTL for the 'E' format. I propose this patch. OK if it passes testsuite and bootstrap? Or should this wait for 4.1? Ian 2005-02-10 Ian Lance Taylor <[EMAIL PROTECTED]> * read-rtl.c (read_rtx_1): Give fatal error if we see a vector with no elements. Index: read-rtl.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/read-rtl.c,v retrieving revision 1.32 diff -p -u -r1.32 read-rtl.c --- read-rtl.c 29 Sep 2004 11:23:11 -0000 1.32 +++ read-rtl.c 11 Feb 2005 03:15:23 -0000 @@ -1253,6 +1253,9 @@ read_rtx_1 (FILE *infile) memcpy (&return_vec->elem[0], obstack_finish (&vector_stack), list_counter * sizeof (rtx)); } + else if (format_ptr[i] == 'E') + fatal_with_file_and_line (infile, + "vector must have at least one element"); XVEC (return_rtx, i) = return_vec; obstack_free (&vector_stack, NULL); /* close bracket gotten */