public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Andrew Pinski (QUIC)" <quic_apinski@quicinc.com>
To: Marek Polacek <polacek@redhat.com>,
	"Andrew Pinski (QUIC)" <quic_apinski@quicinc.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: RE: [COMMITTED] c++: Add testcase for this PR [PR97990]
Date: Fri, 16 Feb 2024 21:57:12 +0000	[thread overview]
Message-ID: <DM6PR02MB40585120D6BFD67CB40FA2ECB84C2@DM6PR02MB4058.namprd02.prod.outlook.com> (raw)
In-Reply-To: <Zc-zLpPHVQcyu1i7@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]



> -----Original Message-----
> From: Marek Polacek <polacek@redhat.com>
> Sent: Friday, February 16, 2024 11:11 AM
> To: Andrew Pinski (QUIC) <quic_apinski@quicinc.com>
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [COMMITTED] c++: Add testcase for this PR [PR97990]
> 
> On Fri, Feb 16, 2024 at 11:00:34AM -0800, Andrew Pinski wrote:
> > This testcase was fixed by r14-5934-gf26d68d5d128c8 but we should add
> > one to make sure it does not regress again.
> >
> > Committed as obvious after a quick test on the testcase.
> >
> > 	PR c++/97990
> >
> > gcc/testsuite/ChangeLog:
> >
> > 	* g++.dg/torture/vector-struct-1.C: New test.
> >
> > Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> > ---
> >  gcc/testsuite/g++.dg/torture/vector-struct-1.C | 18
> > ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >  create mode 100644 gcc/testsuite/g++.dg/torture/vector-struct-1.C
> >
> > diff --git a/gcc/testsuite/g++.dg/torture/vector-struct-1.C
> > b/gcc/testsuite/g++.dg/torture/vector-struct-1.C
> > new file mode 100644
> > index 00000000000..e2747417e2d
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/torture/vector-struct-1.C
> > @@ -0,0 +1,18 @@
> > +/* PR c++/97990 */
> > +/* This used to crash with lto and strict aliasing enabled as the
> > +   vector type variant still had TYPE_ALIAS_SET set on it. */
> 
> You don't have -Wstrict-aliasing here without which the test didn't ICE.

Oh you are correct. This is what I committed after testing to make sure it even ICEd before the reference commit.

Thanks,
Andrew Pinski


> 
> > +typedef __attribute__((__vector_size__(sizeof(short)))) short TSimd;
> > +TSimd hh(int); struct y6 {
> > +  TSimd VALUE;
> > +  ~y6();
> > +};
> > +template <class T1,class T2>
> > +auto f2(T1 p1, T2){
> > +  return hh(p1) <= 0;
> > +}
> > +void f1(){
> > +  f2(0, y6{});
> > +}
> > --
> > 2.43.0
> >
> 
> Marek


[-- Attachment #2: 0001-Add-Wstrict-aliasing-to-vector-struct-1.C-testcase.patch --]
[-- Type: application/octet-stream, Size: 1234 bytes --]

From be1027700122d5b57e14eb7ce0040a50fd1762d2 Mon Sep 17 00:00:00 2001
From: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri, 16 Feb 2024 13:26:30 -0800
Subject: [PATCH] Add -Wstrict-aliasing to vector-struct-1.C testcase

As noticed by Marek Polacek in https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645836.html,
this testcase was not failing before without -Wstrict-aliasing so let's add that option.

Committed as obvious after testing to make sure the test is now testing with `-Wstrict-aliasing` and `-flto`.

gcc/testsuite/ChangeLog:

	* g++.dg/torture/vector-struct-1.C: Add -Wstrict-aliasing.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/testsuite/g++.dg/torture/vector-struct-1.C | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/g++.dg/torture/vector-struct-1.C b/gcc/testsuite/g++.dg/torture/vector-struct-1.C
index e2747417e2d..969a801e680 100644
--- a/gcc/testsuite/g++.dg/torture/vector-struct-1.C
+++ b/gcc/testsuite/g++.dg/torture/vector-struct-1.C
@@ -1,3 +1,4 @@
+/* { dg-options "-Wstrict-aliasing" } */
 /* PR c++/97990 */
 /* This used to crash with lto and strict aliasing enabled as the
    vector type variant still had TYPE_ALIAS_SET set on it. */
-- 
2.43.0


      reply	other threads:[~2024-02-16 21:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 19:00 Andrew Pinski
2024-02-16 19:10 ` Marek Polacek
2024-02-16 21:57   ` Andrew Pinski (QUIC) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR02MB40585120D6BFD67CB40FA2ECB84C2@DM6PR02MB4058.namprd02.prod.outlook.com \
    --to=quic_apinski@quicinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).