diff mbox

[2/2] Add patch for debugging compiler ICEs.

Message ID 87fvfefrbw.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Sept. 26, 2014, 1:23 p.m. UTC
Hi!

On Fri, 26 Sep 2014 12:04:45 +0400, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote:
> Thank you all for your help!
> 
> Done in r215633.
> 
> -Maxim
> On 09/25/2014 11:05 PM, Jeff Law wrote:
> > On 09/23/14 01:14, Maxim Ostapenko wrote:
> >>
> >>
> >> 2014-09-04  Jakub Jelinek<jakub@redhat.com>
> >>         Max Ostapenko<m.ostapenko@partner.samsung.com>
> >>
> >>     * common.opt: New option.
> >>     * doc/invoke.texi: Describe new option.
> >>     * gcc.c (execute): Don't free first string early, but at the end
> >>     of the function.  Call retry_ice if compiler exited with
> >>     ICE_EXIT_CODE.
> >>     (main): Factor out common code.
> >>     (print_configuration): New function.
> >>     (files_equal_p): Likewise.
> >>     (check_repro): Likewise.
> >>     (run_attempt): Likewise.
> >>     (do_report_bug): Likewise.
> >>     (append_text): Likewise.
> >>     (try_generate_repro): Likewise
> > Approved.  Please install.
> >
> > Thanks for your patience,
> > Jeff

This is causing compiler warnings, respectively bootstrap errors:

    [...]
    ../../master/gcc/gcc.c: In function 'attempt_status run_attempt(const char**, const char*, const char*, int, int)':
    ../../master/gcc/gcc.c:6319:15: error: variable 'errmsg' set but not used [-Werror=unused-but-set-variable]
       const char *errmsg;
                   ^
    ../../master/gcc/gcc.c: At global scope:
    ../../master/gcc/gcc.c:6412:33: error: unused parameter 'prog' [-Werror=unused-parameter]
     try_generate_repro (const char *prog, const char **argv)
                                     ^
    cc1plus: all warnings being treated as errors
    Makefile:1040: recipe for target 'gcc.o' failed
    make[3]: *** [gcc.o] Error 1
    make[3]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build/gcc'
    Makefile:4285: recipe for target 'all-stage2-gcc' failed
    make[2]: *** [all-stage2-gcc] Error 2
    make[2]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
    Makefile:21561: recipe for target 'stage2-bubble' failed
    make[1]: *** [stage2-bubble] Error 2
    make[1]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
    Makefile:892: recipe for target 'all' failed
    make: *** [all] Error 2

OK to fix as follows?  Only compile-tested, did not test the new
-freport-bug functionality.




Grüße,
 Thomas

Comments

max Sept. 26, 2014, 1:31 p.m. UTC | #1
Ugh, sorry. Thanks for fixing this.

On 09/26/2014 05:23 PM, Thomas Schwinge wrote:
> Hi!
>
> On Fri, 26 Sep 2014 12:04:45 +0400, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote:
>> Thank you all for your help!
>>
>> Done in r215633.
>>
>> -Maxim
>> On 09/25/2014 11:05 PM, Jeff Law wrote:
>>> On 09/23/14 01:14, Maxim Ostapenko wrote:
>>>>
>>>> 2014-09-04  Jakub Jelinek<jakub@redhat.com>
>>>>          Max Ostapenko<m.ostapenko@partner.samsung.com>
>>>>
>>>>      * common.opt: New option.
>>>>      * doc/invoke.texi: Describe new option.
>>>>      * gcc.c (execute): Don't free first string early, but at the end
>>>>      of the function.  Call retry_ice if compiler exited with
>>>>      ICE_EXIT_CODE.
>>>>      (main): Factor out common code.
>>>>      (print_configuration): New function.
>>>>      (files_equal_p): Likewise.
>>>>      (check_repro): Likewise.
>>>>      (run_attempt): Likewise.
>>>>      (do_report_bug): Likewise.
>>>>      (append_text): Likewise.
>>>>      (try_generate_repro): Likewise
>>> Approved.  Please install.
>>>
>>> Thanks for your patience,
>>> Jeff
> This is causing compiler warnings, respectively bootstrap errors:
>
>      [...]
>      ../../master/gcc/gcc.c: In function 'attempt_status run_attempt(const char**, const char*, const char*, int, int)':
>      ../../master/gcc/gcc.c:6319:15: error: variable 'errmsg' set but not used [-Werror=unused-but-set-variable]
>         const char *errmsg;
>                     ^
>      ../../master/gcc/gcc.c: At global scope:
>      ../../master/gcc/gcc.c:6412:33: error: unused parameter 'prog' [-Werror=unused-parameter]
>       try_generate_repro (const char *prog, const char **argv)
>                                       ^
>      cc1plus: all warnings being treated as errors
>      Makefile:1040: recipe for target 'gcc.o' failed
>      make[3]: *** [gcc.o] Error 1
>      make[3]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build/gcc'
>      Makefile:4285: recipe for target 'all-stage2-gcc' failed
>      make[2]: *** [all-stage2-gcc] Error 2
>      make[2]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
>      Makefile:21561: recipe for target 'stage2-bubble' failed
>      make[1]: *** [stage2-bubble] Error 2
>      make[1]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
>      Makefile:892: recipe for target 'all' failed
>      make: *** [all] Error 2
>
> OK to fix as follows?  Only compile-tested, did not test the new
> -freport-bug functionality.

This works fine on pr55843 and pr58987.

> diff --git gcc/gcc.c gcc/gcc.c
> index e32ff47..47c4e28 100644
> --- gcc/gcc.c
> +++ gcc/gcc.c
> @@ -253,7 +253,7 @@ static void init_gcc_specs (struct obstack *, const char *, const char *,
>   static const char *convert_filename (const char *, int, int);
>   #endif
>   
> -static void try_generate_repro (const char *prog, const char **argv);
> +static void try_generate_repro (const char **argv);
>   static const char *getenv_spec_function (int, const char **);
>   static const char *if_exists_spec_function (int, const char **);
>   static const char *if_exists_else_spec_function (int, const char **);
> @@ -2918,7 +2918,7 @@ execute (void)
>   		&& i == 0
>   		&& (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
>   		&& ! strncmp (p + 1, "cc1", 3))
> -	      try_generate_repro (commands[0].prog, commands[0].argv);
> +	      try_generate_repro (commands[0].argv);
>   	    if (WEXITSTATUS (status) > greatest_status)
>   	      greatest_status = WEXITSTATUS (status);
>   	    ret_code = -1;
> @@ -6332,6 +6332,16 @@ run_attempt (const char **new_argv, const char *out_temp,
>     errmsg = pex_run (pex, pex_flags, new_argv[0],
>   		    CONST_CAST2 (char *const *, const char **, &new_argv[1]), out_temp,
>   		    err_temp, &err);
> +  if (errmsg != NULL)
> +    {
> +      if (err == 0)
> +	fatal_error (errmsg);
> +      else
> +	{
> +	  errno = err;
> +	  pfatal_with_name (errmsg);
> +	}
> +    }
>   
>     if (!pex_get_status (pex, 1, &exit_status))
>       goto out;
> @@ -6409,7 +6419,7 @@ append_text (char *file, const char *str)
>      and preprocessed source code.  */
>   
>   static void
> -try_generate_repro (const char *prog, const char **argv)
> +try_generate_repro (const char **argv)
>   {
>     int i, nargs, out_arg = -1, quiet = 0, attempt;
>     const char **new_argv;
>
>
>
> Grüße,
>   Thomas
-Maxim
Jeff Law Sept. 26, 2014, 4:18 p.m. UTC | #2
On 09/26/14 07:23, Thomas Schwinge wrote:
> Hi!
>
> On Fri, 26 Sep 2014 12:04:45 +0400, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote:
>> Thank you all for your help!
>>
>> Done in r215633.
>>
>> -Maxim
>> On 09/25/2014 11:05 PM, Jeff Law wrote:
>>> On 09/23/14 01:14, Maxim Ostapenko wrote:
>>>>
>>>>
>>>> 2014-09-04  Jakub Jelinek<jakub@redhat.com>
>>>>          Max Ostapenko<m.ostapenko@partner.samsung.com>
>>>>
>>>>      * common.opt: New option.
>>>>      * doc/invoke.texi: Describe new option.
>>>>      * gcc.c (execute): Don't free first string early, but at the end
>>>>      of the function.  Call retry_ice if compiler exited with
>>>>      ICE_EXIT_CODE.
>>>>      (main): Factor out common code.
>>>>      (print_configuration): New function.
>>>>      (files_equal_p): Likewise.
>>>>      (check_repro): Likewise.
>>>>      (run_attempt): Likewise.
>>>>      (do_report_bug): Likewise.
>>>>      (append_text): Likewise.
>>>>      (try_generate_repro): Likewise
>>> Approved.  Please install.
>>>
>>> Thanks for your patience,
>>> Jeff
>
> This is causing compiler warnings, respectively bootstrap errors:
>
>      [...]
>      ../../master/gcc/gcc.c: In function 'attempt_status run_attempt(const char**, const char*, const char*, int, int)':
>      ../../master/gcc/gcc.c:6319:15: error: variable 'errmsg' set but not used [-Werror=unused-but-set-variable]
>         const char *errmsg;
>                     ^
>      ../../master/gcc/gcc.c: At global scope:
>      ../../master/gcc/gcc.c:6412:33: error: unused parameter 'prog' [-Werror=unused-parameter]
>       try_generate_repro (const char *prog, const char **argv)
>                                       ^
>      cc1plus: all warnings being treated as errors
>      Makefile:1040: recipe for target 'gcc.o' failed
>      make[3]: *** [gcc.o] Error 1
>      make[3]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build/gcc'
>      Makefile:4285: recipe for target 'all-stage2-gcc' failed
>      make[2]: *** [all-stage2-gcc] Error 2
>      make[2]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
>      Makefile:21561: recipe for target 'stage2-bubble' failed
>      make[1]: *** [stage2-bubble] Error 2
>      make[1]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
>      Makefile:892: recipe for target 'all' failed
>      make: *** [all] Error 2
>
> OK to fix as follows?  Only compile-tested, did not test the new
> -freport-bug functionality.
[ ... ]
Please construct a ChangeLog and commit.  Thanks.

jeff
Thomas Schwinge Sept. 26, 2014, 4:31 p.m. UTC | #3
Hi!

On Fri, 26 Sep 2014 10:18:32 -0600, Jeff Law <law@redhat.com> wrote:
> On 09/26/14 07:23, Thomas Schwinge wrote:
> > On Fri, 26 Sep 2014 12:04:45 +0400, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote:
> >> Done in r215633.

> > This is causing compiler warnings, respectively bootstrap errors: [...]

> > OK to fix as follows?  Only compile-tested, did not test the new
> > -freport-bug functionality.
> [ ... ]
> Please construct a ChangeLog and commit.  Thanks.

After Maxim had sent his email about having successfully tested it, I had
already taken the opportunity to commit it: r215644.


Grüße,
 Thomas
Jeff Law Sept. 26, 2014, 4:32 p.m. UTC | #4
On 09/26/14 10:31, Thomas Schwinge wrote:
> Hi!
>
> On Fri, 26 Sep 2014 10:18:32 -0600, Jeff Law <law@redhat.com> wrote:
>> On 09/26/14 07:23, Thomas Schwinge wrote:
>>> On Fri, 26 Sep 2014 12:04:45 +0400, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote:
>>>> Done in r215633.
>
>>> This is causing compiler warnings, respectively bootstrap errors: [...]
>
>>> OK to fix as follows?  Only compile-tested, did not test the new
>>> -freport-bug functionality.
>> [ ... ]
>> Please construct a ChangeLog and commit.  Thanks.
>
> After Maxim had sent his email about having successfully tested it, I had
> already taken the opportunity to commit it: r215644.
Thanks.
jeff
diff mbox

Patch

diff --git gcc/gcc.c gcc/gcc.c
index e32ff47..47c4e28 100644
--- gcc/gcc.c
+++ gcc/gcc.c
@@ -253,7 +253,7 @@  static void init_gcc_specs (struct obstack *, const char *, const char *,
 static const char *convert_filename (const char *, int, int);
 #endif
 
-static void try_generate_repro (const char *prog, const char **argv);
+static void try_generate_repro (const char **argv);
 static const char *getenv_spec_function (int, const char **);
 static const char *if_exists_spec_function (int, const char **);
 static const char *if_exists_else_spec_function (int, const char **);
@@ -2918,7 +2918,7 @@  execute (void)
 		&& i == 0
 		&& (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
 		&& ! strncmp (p + 1, "cc1", 3))
-	      try_generate_repro (commands[0].prog, commands[0].argv);
+	      try_generate_repro (commands[0].argv);
 	    if (WEXITSTATUS (status) > greatest_status)
 	      greatest_status = WEXITSTATUS (status);
 	    ret_code = -1;
@@ -6332,6 +6332,16 @@  run_attempt (const char **new_argv, const char *out_temp,
   errmsg = pex_run (pex, pex_flags, new_argv[0],
 		    CONST_CAST2 (char *const *, const char **, &new_argv[1]), out_temp,
 		    err_temp, &err);
+  if (errmsg != NULL)
+    {
+      if (err == 0)
+	fatal_error (errmsg);
+      else
+	{
+	  errno = err;
+	  pfatal_with_name (errmsg);
+	}
+    }
 
   if (!pex_get_status (pex, 1, &exit_status))
     goto out;
@@ -6409,7 +6419,7 @@  append_text (char *file, const char *str)
    and preprocessed source code.  */
 
 static void
-try_generate_repro (const char *prog, const char **argv)
+try_generate_repro (const char **argv)
 {
   int i, nargs, out_arg = -1, quiet = 0, attempt;
   const char **new_argv;