aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMatthew Malcomson <matthew.malcomson@arm.com>2019-11-18 11:16:46 +0000
committerMatthew Malcomson <matmal01@gcc.gnu.org>2019-11-18 11:16:46 +0000
commit20a380171f5db5f356b173d573559bfeef1ebbff (patch)
tree6917b6d723309b3e12013c39ef8855b345a135e2 /gcc/c
parentef50b972e10238a1ac20f23ce3bb32187ae4cb84 (diff)
downloadgcc-20a380171f5db5f356b173d573559bfeef1ebbff.zip
gcc-20a380171f5db5f356b173d573559bfeef1ebbff.tar.gz
gcc-20a380171f5db5f356b173d573559bfeef1ebbff.tar.bz2
[mid-end][__RTL] Clean state despite unspecified __RTL startwith passes
Hi there, When compiling an __RTL function that has an unspecified "startwith" pass we currently don't run the cleanup pass, this means that we ICE on the next function (if it's a basic function). This change ensures that the clean_state pass is run even if the startwith pass is unspecified. We also ensure the name of the startwith pass is always freed correctly. As an example, before this change the following code would ICE when compiling the function `foo_a`. When compiled with ./aarch64-none-linux-gnu-gcc -O0 -S unspecified-pass-error.c -o test.s ``` int __RTL () badfoo () { (function "badfoo" (insn-chain (block 2 (edge-from entry (flags "FALLTHRU")) (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) (cinsn 101 (set (reg:DI x19) (reg:DI x0))) (cinsn 10 (use (reg/i:SI x19))) (edge-to exit (flags "FALLTHRU")) ) ;; block 2 ) ;; insn-chain ) ;; function "foo2" } int foo_a () { return 200; } ``` Now it silently ignores the __RTL function and successfully compiles foo_a. regtest done on aarch64 regtest done on x86_64 OK for trunk? gcc/ChangeLog: 2019-11-18 Matthew Malcomson <matthew.malcomson@arm.com> * run-rtl-passes.c (run_rtl_passes): Accept and handle empty "initial_pass_name" argument -- by running "*clean_state" pass. Also free the "initial_pass_name" when done. gcc/c/ChangeLog: 2019-11-18 Matthew Malcomson <matthew.malcomson@arm.com> * c-parser.c (c_parser_parse_rtl_body): Always call run_rtl_passes, even if startwith pass is not provided. gcc/testsuite/ChangeLog: 2019-11-18 Matthew Malcomson <matthew.malcomson@arm.com> * gcc.dg/rtl/aarch64/unspecified-pass-error.c: New test. From-SVN: r278393
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-parser.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 0076e83..0658ea0d 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-18 Matthew Malcomson <matthew.malcomson@arm.com>
+
+ * c-parser.c (c_parser_parse_rtl_body): Always call
+ run_rtl_passes, even if startwith pass is not provided.
+
2019-11-15 Joseph Myers <joseph@codesourcery.com>
* c-parser.c (c_parser_std_attribute_specifier): Diagnose
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index e48760d..2efa234 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -21574,11 +21574,9 @@ c_parser_parse_rtl_body (c_parser *parser, char *start_with_pass)
return;
}
- /* If a pass name was provided for START_WITH_PASS, run the backend
- accordingly now, on the cfun created above, transferring
- ownership of START_WITH_PASS. */
- if (start_with_pass)
- run_rtl_passes (start_with_pass);
+ /* Run the backend on the cfun created above, transferring ownership of
+ START_WITH_PASS. */
+ run_rtl_passes (start_with_pass);
}
#include "gt-c-c-parser.h"