diff mbox series

[committed] add test for PR 86650

Message ID 614fd76d-a832-51f0-146a-9cae07748d90@gmail.com
State New
Headers show
Series [committed] add test for PR 86650 | expand

Commit Message

Martin Sebor July 6, 2021, 9:37 p.m. UTC
The recent patch series to improve warning suppression for inlined
functions [PR98512] also implicitly includes the inlining context
in all warning messages for inlined code.  In r12-2091 I have
committed the attached test to verify that -Warray-bounds too
includes this context (its absence its the subject of PR 86650).

Martin

Comments

Bin.Cheng July 20, 2021, 8:26 a.m. UTC | #1
On Wed, Jul 7, 2021 at 5:39 AM Martin Sebor via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The recent patch series to improve warning suppression for inlined
> functions [PR98512] also implicitly includes the inlining context
> in all warning messages for inlined code.  In r12-2091 I have
> committed the attached test to verify that -Warray-bounds too
> includes this context (its absence its the subject of PR 86650).
Hi,
It seems this patch exposes/causes uninitialized warning in arm_neon.h
like the following one:

__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vst2q_s32 (int32_t * __a, int32x4x2_t __val)
{
  __builtin_aarch64_simd_oi __o;
  __o = __builtin_aarch64_set_qregoiv4si (__o, (int32x4_t) __val.val[0], 0);
  __o = __builtin_aarch64_set_qregoiv4si (__o, (int32x4_t) __val.val[1], 1);
  __builtin_aarch64_st2v4si ((__builtin_aarch64_simd_si *) __a, __o);
}

Thanks,
bin
Kyrylo Tkachov July 20, 2021, 8:30 a.m. UTC | #2
> -----Original Message-----
> From: Bin.Cheng <amker.cheng@gmail.com>
> Sent: 20 July 2021 09:26
> To: Martin Sebor <msebor@gmail.com>; Kyrylo Tkachov
> <Kyrylo.Tkachov@arm.com>
> Cc: gcc-patches <gcc-patches@gcc.gnu.org>
> Subject: Re: [committed] add test for PR 86650
> 
> On Wed, Jul 7, 2021 at 5:39 AM Martin Sebor via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > The recent patch series to improve warning suppression for inlined
> > functions [PR98512] also implicitly includes the inlining context
> > in all warning messages for inlined code.  In r12-2091 I have
> > committed the attached test to verify that -Warray-bounds too
> > includes this context (its absence its the subject of PR 86650).
> Hi,
> It seems this patch exposes/causes uninitialized warning in arm_neon.h
> like the following one:
> 
> __extension__ extern __inline void
> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
> vst2q_s32 (int32_t * __a, int32x4x2_t __val)
> {
>   __builtin_aarch64_simd_oi __o;
>   __o = __builtin_aarch64_set_qregoiv4si (__o, (int32x4_t) __val.val[0], 0);
>   __o = __builtin_aarch64_set_qregoiv4si (__o, (int32x4_t) __val.val[1], 1);
>   __builtin_aarch64_st2v4si ((__builtin_aarch64_simd_si *) __a, __o);
> }

I believe Jonathan is working in this area to rework these intrinsics.
Can you file a bug report to track this please.
Thanks,
Kyrill

> 
> Thanks,
> bin
diff mbox series

Patch

commit ee9a0e93156ff3d41450db74172abc8ae2471d1f
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 6 15:15:53 2021 -0600

    Add test for [PR86650].
    
    PR tree-optimization/86650 - -Warray-bounds missing inlining context
    
    gcc/testsuite/ChangeLog:
            PR tree-optimization/86650
            * gcc.dg/Warray-bounds-76.c: New test.

diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-76.c b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
new file mode 100644
index 00000000000..6711dc45f30
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
@@ -0,0 +1,35 @@ 
+/* PR tree-optimization/86650 - -Warray-bounds missing inlining context
+   { dg-do compile }
+   { dg-options "-O2 -Wall" } */
+
+static void f0 (int *p, int i)
+{
+  p[i] = 0;         // { dg-warning "\\\[-Warray-bounds" }
+}
+
+// Expect two instances of the text below:
+// { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
+// { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
+
+static void f1 (int *p, int i) { f0 (p + 1, i + 1); }
+static void f2 (int *p, int i) { f1 (p + 1, i + 1); }
+
+extern int a2[2];   // { dg-note "'a2'" }
+
+void foo (void)
+{
+  f1 (a2 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'foo' at \[^:\]+Warray-bounds-76.c:21:\\d+:" "inlined from foo" }
+
+extern int a3[3];   // { dg-note "'a3'" }
+
+void bar (void)
+{
+  f2 (a3 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'f1' at \[^:\]+Warray-bounds-76.c:14:\\d+," "inlined from f1" }
+// { dg-regexp " +inlined from 'f2' at \[^:\]+Warray-bounds-76.c:15:\\d+," "inlined from f2" }
+// { dg-regexp " +inlined from 'bar' at \[^:\]+Warray-bounds-76.c:30:\\d+:" "inlined from bar" }