Hi! Matthias reported that -freport-bug may insert preprocessor diagnostics into middle of the preprocessed dump generated by -freport-bug. The diagnostic text in there is intentional, but should be at the beginning of the file and each line prefixed with //, which is done, but then because of the following bug it can appear once more. do_report_bug 3rd argument is the file where to store the stdout, which for the -E -o - invocation is the preprocessed source and we're appending it there, after the // lines already prepared earlier. The 4th argument is where we put the error output, and it happened to be the same file. We don't really need it (so in theory could also use /dev/null, but the file already exists anyway and we have code to remove it later in any case).
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-01-09 Jakub Jelinek <ja...@redhat.com> PR preprocessor/83722 * gcc.c (try_generate_repro): Pass &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to do_report_bug. --- gcc/gcc.c.jj 2018-01-03 10:19:54.764533895 +0100 +++ gcc/gcc.c 2018-01-08 12:48:30.918627648 +0100 @@ -7035,8 +7035,8 @@ try_generate_repro (const char **argv) /* In final attempt we append compiler options and preprocesssed code to last generated .out file with configuration and backtrace. */ - char **output = &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1]; - do_report_bug (new_argv, nargs, stderr_commented, output); + char **err = &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1]; + do_report_bug (new_argv, nargs, stderr_commented, err); } out: Jakub