diff mbox

Add guality [p]type test.

Message ID 1408450238.3370.14.camel@bordewijk.wildebeest.org
State New
Headers show

Commit Message

Mark Wielaard Aug. 19, 2014, 12:10 p.m. UTC
On Tue, 2014-08-19 at 13:22 +0200, Richard Biener wrote:
> On Tue, Aug 19, 2014 at 1:05 PM, Mark Wielaard <mjw@redhat.com> wrote:
> > On Mon, 2014-07-07 at 11:57 +0200, Richard Biener wrote:
> >> Btw, why doesn't it succeed with LTO?  I suspect it's because
> >> we drop the unused variables - try adding __attribute__((used)) to
> >> them.
> >
> > You are right, this makes the whole new test PASS also with LTO:
> >
> > 2014-08-19  Mark Wielaard  <mjw@redhat.com>
> >
> >     * gcc.dg/guality/const-volatile.c: Add `used' attribute to pi.
> >
> > OK to commit?
> 
> Ok.

Here is the same for the new restrict.c testcase.

gcc/testsuite/ChangeLog
2014-08-19  Mark Wielaard  <mjw@redhat.com>
 
    * gcc.dg/guality/restrict.c: Add `used' attribute to all variables.
    (cpy): Change type of last argument to int.

That last change is necessary to succeed with LTO. Otherwise the type of
the function:

static __attribute__((noclone, noinline)) void *
cpy (void * restrict s1, const void * restrict s2, unsigned int n)

comes out as:

void *(void * restrict, const void * restrict, __unknown__)

That seems a genuine bug. Should I commit the cpy function type change
to make the test PASS with LTO? Or leave it as is so it FAILs and
someone else can look into it?

Thanks,

Mark

Comments

Richard Biener Aug. 19, 2014, 12:16 p.m. UTC | #1
On Tue, Aug 19, 2014 at 2:10 PM, Mark Wielaard <mjw@redhat.com> wrote:
> On Tue, 2014-08-19 at 13:22 +0200, Richard Biener wrote:
>> On Tue, Aug 19, 2014 at 1:05 PM, Mark Wielaard <mjw@redhat.com> wrote:
>> > On Mon, 2014-07-07 at 11:57 +0200, Richard Biener wrote:
>> >> Btw, why doesn't it succeed with LTO?  I suspect it's because
>> >> we drop the unused variables - try adding __attribute__((used)) to
>> >> them.
>> >
>> > You are right, this makes the whole new test PASS also with LTO:
>> >
>> > 2014-08-19  Mark Wielaard  <mjw@redhat.com>
>> >
>> >     * gcc.dg/guality/const-volatile.c: Add `used' attribute to pi.
>> >
>> > OK to commit?
>>
>> Ok.
>
> Here is the same for the new restrict.c testcase.
>
> gcc/testsuite/ChangeLog
> 2014-08-19  Mark Wielaard  <mjw@redhat.com>
>
>     * gcc.dg/guality/restrict.c: Add `used' attribute to all variables.
>     (cpy): Change type of last argument to int.
>
> That last change is necessary to succeed with LTO. Otherwise the type of
> the function:
>
> static __attribute__((noclone, noinline)) void *
> cpy (void * restrict s1, const void * restrict s2, unsigned int n)
>
> comes out as:
>
> void *(void * restrict, const void * restrict, __unknown__)
>
> That seems a genuine bug. Should I commit the cpy function type change
> to make the test PASS with LTO? Or leave it as is so it FAILs and
> someone else can look into it?

Yeah, that's a genuine bug.  Not sure why it happens.  If you file a bug
I can have a look later.

Thanks,
Richard.

> Thanks,
>
> Mark
>
> diff --git a/gcc/testsuite/gcc.dg/guality/restrict.c b/gcc/testsuite/gcc.dg/guality/restrict.c
> index e31224b..43a4ede 100644
> --- a/gcc/testsuite/gcc.dg/guality/restrict.c
> +++ b/gcc/testsuite/gcc.dg/guality/restrict.c
> @@ -2,19 +2,19 @@
>  /* { dg-do run } */
>  /* { dg-options "-std=c99 -gdwarf-3" } */
>
> -int *ip;
> -const int *cip;
> -int * restrict irp;
> -int * const icp;
> -const int * restrict cirp;
> -int * const restrict icrp;
> -const int * const restrict cicrp;
> +int *ip __attribute__((used));
> +const int *cip __attribute__((used));
> +int * restrict irp __attribute__((used));
> +int * const icp __attribute__((used));
> +const int * restrict cirp __attribute__((used));
> +int * const restrict icrp __attribute__((used));
> +const int * const restrict cicrp __attribute__((used));
>
> -int * const volatile restrict cvirp;
> -const volatile int * restrict pcvir;
> +int * const volatile restrict cvirp __attribute__((used));
> +const volatile int * restrict pcvir __attribute__((used));
>
>  static __attribute__((noclone, noinline)) void *
> -cpy (void * restrict s1, const void * restrict s2, unsigned int n)
> +cpy (void * restrict s1, const void * restrict s2, int n)
>  {
>    char *t1 = s1;
>    const char *t2 = s2;
> @@ -45,4 +45,4 @@ main (int argc, char **argv)
>  /* { dg-final { gdb-test 30 "type:pcvir" "const volatile int * restrict" } } */
>
>  /* { dg-final { gdb-test 30 "type:main" "int (int, char **)" } } */
> -/* { dg-final { gdb-test 30 "type:cpy" "void *(void * restrict, const void * restrict, unsigned int)" } } */
> +/* { dg-final { gdb-test 30 "type:cpy" "void *(void * restrict, const void * restrict, int)" } } */
>
Mark Wielaard Aug. 19, 2014, 5:52 p.m. UTC | #2
On Tue, 2014-08-19 at 14:16 +0200, Richard Biener wrote:
> On Tue, Aug 19, 2014 at 2:10 PM, Mark Wielaard <mjw@redhat.com> wrote:
> > gcc/testsuite/ChangeLog
> > 2014-08-19  Mark Wielaard  <mjw@redhat.com>
> >
> >     * gcc.dg/guality/restrict.c: Add `used' attribute to all variables.
> >     (cpy): Change type of last argument to int.
> >
> > That last change is necessary to succeed with LTO. Otherwise the type of
> > the function:
> >
> > static __attribute__((noclone, noinline)) void *
> > cpy (void * restrict s1, const void * restrict s2, unsigned int n)
> >
> > comes out as:
> >
> > void *(void * restrict, const void * restrict, __unknown__)
> >
> > That seems a genuine bug. Should I commit the cpy function type change
> > to make the test PASS with LTO? Or leave it as is so it FAILs and
> > someone else can look into it?
> 
> Yeah, that's a genuine bug.  Not sure why it happens.  If you file a bug
> I can have a look later.

Filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62190 "LTO DWARF
produces __unknown__ type for unsigned int function argument type".

I included a smaller testcase in the bug that can just be dropped into
gcc/testsuite/gcc.dg/guality/ to show the issue. Shall I just commit the
change to the restrict.c testcase, so at least that one always PASSes
for now?

Cheers,

Mark
Richard Biener Aug. 20, 2014, 8:49 a.m. UTC | #3
On Tue, Aug 19, 2014 at 7:52 PM, Mark Wielaard <mjw@redhat.com> wrote:
> On Tue, 2014-08-19 at 14:16 +0200, Richard Biener wrote:
>> On Tue, Aug 19, 2014 at 2:10 PM, Mark Wielaard <mjw@redhat.com> wrote:
>> > gcc/testsuite/ChangeLog
>> > 2014-08-19  Mark Wielaard  <mjw@redhat.com>
>> >
>> >     * gcc.dg/guality/restrict.c: Add `used' attribute to all variables.
>> >     (cpy): Change type of last argument to int.
>> >
>> > That last change is necessary to succeed with LTO. Otherwise the type of
>> > the function:
>> >
>> > static __attribute__((noclone, noinline)) void *
>> > cpy (void * restrict s1, const void * restrict s2, unsigned int n)
>> >
>> > comes out as:
>> >
>> > void *(void * restrict, const void * restrict, __unknown__)
>> >
>> > That seems a genuine bug. Should I commit the cpy function type change
>> > to make the test PASS with LTO? Or leave it as is so it FAILs and
>> > someone else can look into it?
>>
>> Yeah, that's a genuine bug.  Not sure why it happens.  If you file a bug
>> I can have a look later.
>
> Filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62190 "LTO DWARF
> produces __unknown__ type for unsigned int function argument type".
>
> I included a smaller testcase in the bug that can just be dropped into
> gcc/testsuite/gcc.dg/guality/ to show the issue. Shall I just commit the
> change to the restrict.c testcase, so at least that one always PASSes
> for now?

No need - I have a fix in testing.

Richard.

> Cheers,
>
> Mark
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/guality/restrict.c b/gcc/testsuite/gcc.dg/guality/restrict.c
index e31224b..43a4ede 100644
--- a/gcc/testsuite/gcc.dg/guality/restrict.c
+++ b/gcc/testsuite/gcc.dg/guality/restrict.c
@@ -2,19 +2,19 @@ 
 /* { dg-do run } */
 /* { dg-options "-std=c99 -gdwarf-3" } */
 
-int *ip;
-const int *cip;
-int * restrict irp;
-int * const icp;
-const int * restrict cirp;
-int * const restrict icrp;
-const int * const restrict cicrp;
+int *ip __attribute__((used));
+const int *cip __attribute__((used));
+int * restrict irp __attribute__((used));
+int * const icp __attribute__((used));
+const int * restrict cirp __attribute__((used));
+int * const restrict icrp __attribute__((used));
+const int * const restrict cicrp __attribute__((used));
 
-int * const volatile restrict cvirp;
-const volatile int * restrict pcvir;
+int * const volatile restrict cvirp __attribute__((used));
+const volatile int * restrict pcvir __attribute__((used));
 
 static __attribute__((noclone, noinline)) void *
-cpy (void * restrict s1, const void * restrict s2, unsigned int n)
+cpy (void * restrict s1, const void * restrict s2, int n)
 {
   char *t1 = s1;
   const char *t2 = s2;
@@ -45,4 +45,4 @@  main (int argc, char **argv)
 /* { dg-final { gdb-test 30 "type:pcvir" "const volatile int * restrict" } } */
 
 /* { dg-final { gdb-test 30 "type:main" "int (int, char **)" } } */
-/* { dg-final { gdb-test 30 "type:cpy" "void *(void * restrict, const void * restrict, unsigned int)" } } */
+/* { dg-final { gdb-test 30 "type:cpy" "void *(void * restrict, const void * restrict, int)" } } */