From: Richard Sandiford Date: Sun, 5 Nov 2023 18:24:40 +0000 (+0000) Subject: read-rtl: Fix infinite loop while parsing [...] X-Git-Tag: basepoints/gcc-15~5007 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bd1d548472c4c8e55c40fb3342217ace1a8e78d;p=thirdparty%2Fgcc.git read-rtl: Fix infinite loop while parsing [...] read_rtx_operand would spin endlessly for: (unspec [(...))] UNSPEC_FOO) because read_nested_rtx does nothing if the next character is not '('. gcc/ * read-rtl.cc (read_rtx_operand): Avoid spinning endlessly for invalid [...] operands. --- diff --git a/gcc/read-rtl.cc b/gcc/read-rtl.cc index 292f8b72d434..f3b5613dfdbe 100644 --- a/gcc/read-rtl.cc +++ b/gcc/read-rtl.cc @@ -1896,8 +1896,10 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx) repeat_count--; value = saved_rtx; } - else + else if (c == '(') value = read_nested_rtx (); + else + fatal_with_file_and_line ("unexpected character in vector"); for (; repeat_count > 0; repeat_count--) {