]> gcc.gnu.org Git - gcc.git/commitdiff
read-rtl: Fix infinite loop while parsing [...]
authorRichard Sandiford <richard.sandiford@arm.com>
Sun, 5 Nov 2023 18:24:40 +0000 (18:24 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Sun, 5 Nov 2023 18:24:40 +0000 (18:24 +0000)
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.

gcc/read-rtl.cc

index 292f8b72d434cc40aab42ade589494e0fcbb585e..f3b5613dfdbe41d065034fa784be4eae1c269fb7 100644 (file)
@@ -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--)
              {
This page took 0.061699 seconds and 5 git commands to generate.