This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add guality [p]type test.


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

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)" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]