This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add guality [p]type test.
- From: Mark Wielaard <mjw at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Cary Coutant <ccoutant at google dot com>, Alexandre Oliva <aoliva at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 19 Aug 2014 14:10:38 +0200
- Subject: Re: [PATCH] Add guality [p]type test.
- Authentication-results: sourceware.org; auth=none
- References: <1403265071 dot 6147 dot 5 dot camel at bordewijk dot wildebeest dot org> <1404381209-11280-1-git-send-email-mjw at redhat dot com> <CAFiYyc2xMDLEJEK2iNbzjmt0tVsDzT1XLtt_0-vpVUzF1kHEXg at mail dot gmail dot com> <1408446359 dot 3370 dot 12 dot camel at bordewijk dot wildebeest dot org> <CAFiYyc0X-82YOWT0yv9U3fPRW9FWPEgj3ouOqxeTzg4PLf5yUg at mail dot gmail dot com>
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)" } } */