On Thu, Feb 04, 2016 at 10:31:27AM -0500, David Malcolm wrote: > The jit testsuite was showing numerous segfaults and fatal > errors for trunk on aarch64; typically on the 2nd iteration of each > test, with errors like: > test-volatile.c.exe: fatal error: pass ‘rnreg’ not found but is referenced > by new pass ‘whole-program’ > where the new pass' name varies, and can be bogus, e.g.: > test-nested-loops.c.exe: fatal error: pass 'rnreg' not found but is > referenced by new pass '/tmp/libgccjit-FMb7g3/fake.c' > > This is a regression relative to gcc 5. > > The root cause is that aarch64_register_fma_steering builds and > registers an "fma_steering" pass after "rnreg", but the > struct register_pass_info > containing the arguments to register_pass is marked "static". > Hence after the 1st iteration, the pointer to the pass isn't touched, > and we have a use-after-free of the 1st iteration's pass_fma_steering. > > The attached patch removes the "static" from the relevant local, so > that the pass pointer is updated before each call to register_pass. > > With this patch, the jit testsuite runs successfully (8514 passes) on > gcc113 (aarch64-unknown-linux-gnu). > > I used grep to see if there were any other > "static struct register_pass_info" > in the code, and there's one in the mips backend, so I did the same > change there (untested). > > Bootstrap on aarch64 in progress; I don't have mips handy. > > OK for trunk if it passes?
The AArch64 part is OK (assuming bootstrap and test succeed), thanks. James > > gcc/ChangeLog: > * config/aarch64/cortex-a57-fma-steering.c > (aarch64_register_fma_steering): Remove "static" from arguments > to register_pass. > * config/mips/frame-header-opt.c (mips_register_frame_header_opt): > Likewise. > --- > gcc/config/aarch64/cortex-a57-fma-steering.c | 2 +- > gcc/config/mips/frame-header-opt.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >