diff mbox

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

Message ID 20160906101221.GE14857@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 6, 2016, 10:12 a.m. UTC
On Tue, Sep 06, 2016 at 12:07:47PM +0200, Christophe Lyon wrote:
> 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.
> >
> 
> 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)

Those tests need adjustments, not to expect such errors on line 1, but on
line 0.

I think following untested patch should fix that:



	Jakub

Comments

Christophe Lyon Sept. 6, 2016, 10:41 a.m. UTC | #1
On 6 September 2016 at 12:12, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Sep 06, 2016 at 12:07:47PM +0200, Christophe Lyon wrote:
>> 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.
>> >
>>
>> 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)
>
> Those tests need adjustments, not to expect such errors on line 1, but on
> line 0.
>
> I think following untested patch should fix that:
>
Indeed it does, thanks!

Christophe

> --- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c.jj    2012-10-23 19:54:58.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c       2016-09-06 12:10:32.241560531 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-options "-O2 -march=dummy" } */
>
>  void f ()
> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c.jj     2016-05-18 10:59:49.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c        2016-09-06 12:11:08.170110003 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>  /* { dg-options "-O2 -mcpu=cortex-a53+no" } */
>
> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c.jj     2016-05-18 10:59:49.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c        2016-09-06 12:11:01.698191158 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>  /* { dg-options "-O2 -mcpu=dummy" } */
>
> --- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c.jj    2012-10-23 19:54:58.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c       2016-09-06 12:10:39.737466536 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-options "-O2 -march=+dummy" } */
>
>  void f ()
> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c.jj     2016-05-18 10:59:49.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c        2016-09-06 12:11:13.628041564 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>  /* { dg-options "-O2 -mcpu=cortex-a53+dummy" } */
>
> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c.jj     2016-05-18 10:59:49.000000000 +0200
> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c        2016-09-06 12:11:18.448981111 +0200
> @@ -1,4 +1,4 @@
> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>  /* { dg-options "-O2 -mcpu=+dummy" } */
>
>
>
>         Jakub
Christophe Lyon Sept. 7, 2016, 8:20 p.m. UTC | #2
On 6 September 2016 at 12:41, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> On 6 September 2016 at 12:12, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Tue, Sep 06, 2016 at 12:07:47PM +0200, Christophe Lyon wrote:
>>> 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.
>>> >
>>>
>>> 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)
>>
>> Those tests need adjustments, not to expect such errors on line 1, but on
>> line 0.
>>
>> I think following untested patch should fix that:
>>
> Indeed it does, thanks!
>

I took the liberty of committing it (r240030) on your behalf with this
ChangeLog:
2016-09-07  Jakub Jelinek  <jakub@redhat.com>

        PR middle-end/77475
        * gcc.target/aarch64/arch-diagnostics-1.c: Expect error on line 0.
        * gcc.target/aarch64/arch-diagnostics-2.c: Likewise.
        * gcc.target/aarch64/cpu-diagnostics-1.c: Likewise.
        * gcc.target/aarch64/cpu-diagnostics-2.c: Likewise.
        * gcc.target/aarch64/cpu-diagnostics-3.c: Likewise.
        * gcc.target/aarch64/cpu-diagnostics-4.c: Likewise.

Thanks,

Christophe

> Christophe
>
>> --- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c.jj    2012-10-23 19:54:58.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c       2016-09-06 12:10:32.241560531 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-options "-O2 -march=dummy" } */
>>
>>  void f ()
>> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c.jj     2016-05-18 10:59:49.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c        2016-09-06 12:11:08.170110003 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>>  /* { dg-options "-O2 -mcpu=cortex-a53+no" } */
>>
>> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c.jj     2016-05-18 10:59:49.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c        2016-09-06 12:11:01.698191158 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>>  /* { dg-options "-O2 -mcpu=dummy" } */
>>
>> --- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c.jj    2012-10-23 19:54:58.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c       2016-09-06 12:10:39.737466536 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-options "-O2 -march=+dummy" } */
>>
>>  void f ()
>> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c.jj     2016-05-18 10:59:49.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c        2016-09-06 12:11:13.628041564 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>>  /* { dg-options "-O2 -mcpu=cortex-a53+dummy" } */
>>
>> --- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c.jj     2016-05-18 10:59:49.000000000 +0200
>> +++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c        2016-09-06 12:11:18.448981111 +0200
>> @@ -1,4 +1,4 @@
>> -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
>> +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
>>  /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
>>  /* { dg-options "-O2 -mcpu=+dummy" } */
>>
>>
>>
>>         Jakub
diff mbox

Patch

--- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c.jj	2012-10-23 19:54:58.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c	2016-09-06 12:10:32.241560531 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
+/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-options "-O2 -march=dummy" } */
 
 void f ()
--- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c.jj	2016-05-18 10:59:49.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c	2016-09-06 12:11:08.170110003 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
+/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
 /* { dg-options "-O2 -mcpu=cortex-a53+no" } */
 
--- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c.jj	2016-05-18 10:59:49.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c	2016-09-06 12:11:01.698191158 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */
+/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
 /* { dg-options "-O2 -mcpu=dummy" } */
 
--- gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c.jj	2012-10-23 19:54:58.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c	2016-09-06 12:10:39.737466536 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
+/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-options "-O2 -march=+dummy" } */
 
 void f ()
--- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c.jj	2016-05-18 10:59:49.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c	2016-09-06 12:11:13.628041564 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } } */
+/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
 /* { dg-options "-O2 -mcpu=cortex-a53+dummy" } */
 
--- gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c.jj	2016-05-18 10:59:49.000000000 +0200
+++ gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c	2016-09-06 12:11:18.448981111 +0200
@@ -1,4 +1,4 @@ 
-/* { dg-error "missing" "" {target "aarch64*-*-*" } } */
+/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */
 /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */
 /* { dg-options "-O2 -mcpu=+dummy" } */