diff mbox

Fix location of command line backend reported issues (PR middle-end/77475)

Message ID 20160905172057.GX14857@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 5, 2016, 5:20 p.m. UTC
Hi!

While it would be perhaps nice to pass explicit location_t in the target
option handling code, there are hundreds of error/warning/sorry calls
in lots of backends, and lots of those routines are used not just
for the process_options time (i.e. command line options), but also for
pragma GCC target and target option handling, so at least for the time being
I think it is easier to just use UNKNOWN_LOCATION for the command line
option diagnostics.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/77475
	* toplev.c (process_options): Temporarily set input_location
	to UNKNOWN_LOCATION around targetm.target_option.override () call.


	Jakub

Comments

Richard Biener Sept. 5, 2016, 6:03 p.m. UTC | #1
On September 5, 2016 7:20:57 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>While it would be perhaps nice to pass explicit location_t in the
>target
>option handling code, there are hundreds of error/warning/sorry calls
>in lots of backends, and lots of those routines are used not just
>for the process_options time (i.e. command line options), but also for
>pragma GCC target and target option handling, so at least for the time
>being
>I think it is easier to just use UNKNOWN_LOCATION for the command line
>option diagnostics.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Richard.

>2016-09-05  Jakub Jelinek  <jakub@redhat.com>
>
>	PR middle-end/77475
>	* toplev.c (process_options): Temporarily set input_location
>	to UNKNOWN_LOCATION around targetm.target_option.override () call.
>
>--- gcc/toplev.c.jj	2016-09-03 11:18:55.000000000 +0200
>+++ gcc/toplev.c	2016-09-05 15:05:19.819995470 +0200
>@@ -1220,7 +1220,10 @@ process_options (void)
>   no_backend = lang_hooks.post_options (&main_input_filename);
> 
>   /* Some machines may reject certain combinations of options.  */
>+  location_t saved_location = input_location;
>+  input_location = UNKNOWN_LOCATION;
>   targetm.target_option.override ();
>+  input_location = saved_location;
> 
>   if (flag_diagnostics_generate_patch)
>       global_dc->edit_context_ptr = new edit_context ();
>
>	Jakub
Christophe Lyon Sept. 6, 2016, 10:07 a.m. UTC | #2
On 5 September 2016 at 19:20, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> While it would be perhaps nice to pass explicit location_t in the target
> option handling code, there are hundreds of error/warning/sorry calls
> in lots of backends, and lots of those routines are used not just
> for the process_options time (i.e. command line options), but also for
> pragma GCC target and target option handling, so at least for the time being
> I think it is easier to just use UNKNOWN_LOCATION for the command line
> option diagnostics.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2016-09-05  Jakub Jelinek  <jakub@redhat.com>
>
>         PR middle-end/77475
>         * toplev.c (process_options): Temporarily set input_location
>         to UNKNOWN_LOCATION around targetm.target_option.override () call.
>

Hi,

This patch caused regressions on aarch64. The following tests now fail:
  gcc.target/aarch64/arch-diagnostics-1.c  (test for errors, line 1)
  gcc.target/aarch64/arch-diagnostics-1.c (test for excess errors)
  gcc.target/aarch64/arch-diagnostics-2.c  (test for errors, line 1)
  gcc.target/aarch64/arch-diagnostics-2.c (test for excess errors)
  gcc.target/aarch64/cpu-diagnostics-1.c  (test for errors, line 1)
  gcc.target/aarch64/cpu-diagnostics-1.c (test for excess errors)
  gcc.target/aarch64/cpu-diagnostics-2.c  (test for errors, line 1)
  gcc.target/aarch64/cpu-diagnostics-2.c (test for excess errors)
  gcc.target/aarch64/cpu-diagnostics-3.c  (test for errors, line 1)
  gcc.target/aarch64/cpu-diagnostics-3.c (test for excess errors)
  gcc.target/aarch64/cpu-diagnostics-4.c  (test for errors, line 1)
  gcc.target/aarch64/cpu-diagnostics-4.c (test for excess errors)

Christophe


> --- gcc/toplev.c.jj     2016-09-03 11:18:55.000000000 +0200
> +++ gcc/toplev.c        2016-09-05 15:05:19.819995470 +0200
> @@ -1220,7 +1220,10 @@ process_options (void)
>    no_backend = lang_hooks.post_options (&main_input_filename);
>
>    /* Some machines may reject certain combinations of options.  */
> +  location_t saved_location = input_location;
> +  input_location = UNKNOWN_LOCATION;
>    targetm.target_option.override ();
> +  input_location = saved_location;
>
>    if (flag_diagnostics_generate_patch)
>        global_dc->edit_context_ptr = new edit_context ();
>
>         Jakub
diff mbox

Patch

--- gcc/toplev.c.jj	2016-09-03 11:18:55.000000000 +0200
+++ gcc/toplev.c	2016-09-05 15:05:19.819995470 +0200
@@ -1220,7 +1220,10 @@  process_options (void)
   no_backend = lang_hooks.post_options (&main_input_filename);
 
   /* Some machines may reject certain combinations of options.  */
+  location_t saved_location = input_location;
+  input_location = UNKNOWN_LOCATION;
   targetm.target_option.override ();
+  input_location = saved_location;
 
   if (flag_diagnostics_generate_patch)
       global_dc->edit_context_ptr = new edit_context ();