testsuite: Use -std=gnu17 in gcc.dg/pr114115.c
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
Commit Message
One test failing with a -std=gnu23 default that I wanted to
investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
produces a warning:
pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
It turns out that this warning (from cgraphunit.cc) is disabled for
unprototyped functions. It's not immediately obvious that being
unprototyped has much to do with such incompatibilities of return type
(void versus void *), but it still seems reasonable to address this
warning by adding -std=gnu17 to the options for this testcase, so
minimizing the perturbation to what it tests.
Tested for x86_64.
* gcc.dg/pr114115.c: Use -std=gnu17.
Comments
Ping. This patch
<https://gcc.gnu.org/pipermail/gcc-patches/2024-October/666261.html> is
pending review.
On Wed, Oct 23, 2024 at 05:52:13PM +0000, Joseph Myers wrote:
> One test failing with a -std=gnu23 default that I wanted to
> investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
> produces a warning:
>
> pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
>
> It turns out that this warning (from cgraphunit.cc) is disabled for
> unprototyped functions. It's not immediately obvious that being
> unprototyped has much to do with such incompatibilities of return type
> (void versus void *), but it still seems reasonable to address this
> warning by adding -std=gnu17 to the options for this testcase, so
> minimizing the perturbation to what it tests.
My preference would be just fix the bug in the testcase, i.e.
-void *foo_ifunc2() __attribute__((ifunc("foo_resolver")));
+void foo_ifunc2() __attribute__((ifunc("foo_resolver")));
I've verified it still FAILs with r14-9774 and PASSes with r14-9775
like that and given that the resolver returns bar which returns void
and similarly the resolver returns function pointer returning void,
I think we should go for that.
The void * vs. void doesn't matter for what the test is testing.
The test is derived from the CVE-2024-3094 exploit and I really don't
think we need to test acceptance for the bugs in it.
> --- a/gcc/testsuite/gcc.dg/pr114115.c
> +++ b/gcc/testsuite/gcc.dg/pr114115.c
> @@ -1,5 +1,5 @@
> /* { dg-do compile } */
> -/* { dg-options "-O0 -fprofile-generate -fdump-tree-optimized" } */
> +/* { dg-options "-std=gnu17 -O0 -fprofile-generate -fdump-tree-optimized" } */
> /* { dg-require-profiling "-fprofile-generate" } */
> /* { dg-require-ifunc "" } */
>
Jakub
On Thu, 31 Oct 2024, Jakub Jelinek wrote:
> On Wed, Oct 23, 2024 at 05:52:13PM +0000, Joseph Myers wrote:
> > One test failing with a -std=gnu23 default that I wanted to
> > investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
> > produces a warning:
> >
> > pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
> >
> > It turns out that this warning (from cgraphunit.cc) is disabled for
> > unprototyped functions. It's not immediately obvious that being
> > unprototyped has much to do with such incompatibilities of return type
> > (void versus void *), but it still seems reasonable to address this
> > warning by adding -std=gnu17 to the options for this testcase, so
> > minimizing the perturbation to what it tests.
>
> My preference would be just fix the bug in the testcase, i.e.
> -void *foo_ifunc2() __attribute__((ifunc("foo_resolver")));
> +void foo_ifunc2() __attribute__((ifunc("foo_resolver")));
Here is a patch version to do that. OK to commit?
testsuite: Fix prototype in gcc.dg/pr114115.c
One test failing with a -std=gnu23 default that I wanted to
investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
produces a warning:
pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
It turns out that this warning (from cgraphunit.cc) is disabled for
unprototyped functions. Fix the return type for foo_ifunc2 so the
test builds without warnings both with and without -std=gnu23.
Tested for x86_64.
* gcc.dg/pr114115.c (foo_ifunc2): Return void.
diff --git a/gcc/testsuite/gcc.dg/pr114115.c b/gcc/testsuite/gcc.dg/pr114115.c
index 2629f591877..5e3ef5793cd 100644
--- a/gcc/testsuite/gcc.dg/pr114115.c
+++ b/gcc/testsuite/gcc.dg/pr114115.c
@@ -3,7 +3,7 @@
/* { dg-require-profiling "-fprofile-generate" } */
/* { dg-require-ifunc "" } */
-void *foo_ifunc2() __attribute__((ifunc("foo_resolver")));
+void foo_ifunc2() __attribute__((ifunc("foo_resolver")));
void bar(void)
{
On Thu, Oct 31, 2024 at 05:07:52PM +0000, Joseph Myers wrote:
> On Thu, 31 Oct 2024, Jakub Jelinek wrote:
>
> > On Wed, Oct 23, 2024 at 05:52:13PM +0000, Joseph Myers wrote:
> > > One test failing with a -std=gnu23 default that I wanted to
> > > investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
> > > produces a warning:
> > >
> > > pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
> > >
> > > It turns out that this warning (from cgraphunit.cc) is disabled for
> > > unprototyped functions. It's not immediately obvious that being
> > > unprototyped has much to do with such incompatibilities of return type
> > > (void versus void *), but it still seems reasonable to address this
> > > warning by adding -std=gnu17 to the options for this testcase, so
> > > minimizing the perturbation to what it tests.
> >
> > My preference would be just fix the bug in the testcase, i.e.
> > -void *foo_ifunc2() __attribute__((ifunc("foo_resolver")));
> > +void foo_ifunc2() __attribute__((ifunc("foo_resolver")));
>
> Here is a patch version to do that. OK to commit?
>
>
> testsuite: Fix prototype in gcc.dg/pr114115.c
>
> One test failing with a -std=gnu23 default that I wanted to
> investigate further is gcc.dg/pr114115.c. Building with -std=gnu23
> produces a warning:
>
> pr114115.c:18:8: warning: 'ifunc' resolver for 'foo_ifunc2' should return 'void * (*)(void)' [-Wattribute-alias=]
>
> It turns out that this warning (from cgraphunit.cc) is disabled for
> unprototyped functions. Fix the return type for foo_ifunc2 so the
> test builds without warnings both with and without -std=gnu23.
>
> Tested for x86_64.
>
> * gcc.dg/pr114115.c (foo_ifunc2): Return void.
Ok, thanks.
Jakub
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O0 -fprofile-generate -fdump-tree-optimized" } */
+/* { dg-options "-std=gnu17 -O0 -fprofile-generate -fdump-tree-optimized" } */
/* { dg-require-profiling "-fprofile-generate" } */
/* { dg-require-ifunc "" } */