diff mbox series

Fix -freport-bug (PR preprocessor/83722)

Message ID 20180108235247.GW1833@tucnak
State New
Headers show
Series Fix -freport-bug (PR preprocessor/83722) | expand

Commit Message

Jakub Jelinek Jan. 8, 2018, 11:52 p.m. UTC
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  <jakub@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.


	Jakub

Comments

Richard Biener Jan. 9, 2018, 6:57 a.m. UTC | #1
On January 9, 2018 12:52:47 AM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>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?

OK. 

Richard. 

>2018-01-09  Jakub Jelinek  <jakub@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
diff mbox series

Patch

--- 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: