public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end Fix trapping access in test PR101750
@ 2021-08-03 14:56 Tamar Christina
  2021-08-04  5:50 ` Richard Biener
  2021-08-04 13:34 ` [PATCH][committed]middle-end " Tamar Christina
  0 siblings, 2 replies; 3+ messages in thread
From: Tamar Christina @ 2021-08-03 14:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther

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

Hi All,

I believe PR101750 to be a testism. The reduced case accesses h[0] but h is
uninitialized and so the changes added in r12-2523 makes the compiler realize
this and replaces the code with a trap.

This fixes the case by just making the variable static.

regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/101750
	* g++.dg/vect/pr99149.cc: Fix access of h.

--- inline copy of patch -- 
diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
index 00ebe9d9cdf600ada8e66b4b854f0e18ad0b6a7d..4b885a5d432130d5eff3e96c833ec6c97de3e95d 100755
--- a/gcc/testsuite/g++.dg/vect/pr99149.cc
+++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
@@ -11,8 +11,8 @@ public:
   a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
 };
 int f, g;
-class {
-  a *h;
+class mp {
+  static a *h;
   a *i;
 
 public:


-- 

[-- Attachment #2: rb14746.patch --]
[-- Type: text/x-diff, Size: 445 bytes --]

diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
index 00ebe9d9cdf600ada8e66b4b854f0e18ad0b6a7d..4b885a5d432130d5eff3e96c833ec6c97de3e95d 100755
--- a/gcc/testsuite/g++.dg/vect/pr99149.cc
+++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
@@ -11,8 +11,8 @@ public:
   a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
 };
 int f, g;
-class {
-  a *h;
+class mp {
+  static a *h;
   a *i;
 
 public:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]middle-end Fix trapping access in test PR101750
  2021-08-03 14:56 [PATCH]middle-end Fix trapping access in test PR101750 Tamar Christina
@ 2021-08-04  5:50 ` Richard Biener
  2021-08-04 13:34 ` [PATCH][committed]middle-end " Tamar Christina
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2021-08-04  5:50 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd

On Tue, 3 Aug 2021, Tamar Christina wrote:

> Hi All,
> 
> I believe PR101750 to be a testism. The reduced case accesses h[0] but h is
> uninitialized and so the changes added in r12-2523 makes the compiler realize
> this and replaces the code with a trap.
> 
> This fixes the case by just making the variable static.
> 
> regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?

I don't think that's a correct fix - the variable 'n' is global and thus
n.h could be initialized elsewhere, no?  As said in the PR, the issue
also appears when 'main' is renamed to 'foo'.

Richard.

> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR tree-optimization/101750
> 	* g++.dg/vect/pr99149.cc: Fix access of h.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
> index 00ebe9d9cdf600ada8e66b4b854f0e18ad0b6a7d..4b885a5d432130d5eff3e96c833ec6c97de3e95d 100755
> --- a/gcc/testsuite/g++.dg/vect/pr99149.cc
> +++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
> @@ -11,8 +11,8 @@ public:
>    a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
>  };
>  int f, g;
> -class {
> -  a *h;
> +class mp {
> +  static a *h;
>    a *i;
>  
>  public:
> 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH][committed]middle-end Fix trapping access in test PR101750
  2021-08-03 14:56 [PATCH]middle-end Fix trapping access in test PR101750 Tamar Christina
  2021-08-04  5:50 ` Richard Biener
@ 2021-08-04 13:34 ` Tamar Christina
  1 sibling, 0 replies; 3+ messages in thread
From: Tamar Christina @ 2021-08-04 13:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther

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

Hi All,

I believe PR101750 to be a testism. Fix it by giving the class a name.

regtested on aarch64-none-linux-gnu and no issues.

Committed under the trivial rule.

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/101750
	* g++.dg/vect/pr99149.cc: Name class.

--- inline copy of patch -- 
diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
index 00ebe9d9cdf600ada8e66b4b854f0e18ad0b6a7d..9d584262770c75f53bea9c193d3a44aa792f4d36 100755
--- a/gcc/testsuite/g++.dg/vect/pr99149.cc
+++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
@@ -11,7 +11,7 @@ public:
   a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
 };
 int f, g;
-class {
+class mp {
   a *h;
   a *i;
 


-- 

[-- Attachment #2: rb14746.patch --]
[-- Type: text/x-diff, Size: 420 bytes --]

diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
index 00ebe9d9cdf600ada8e66b4b854f0e18ad0b6a7d..9d584262770c75f53bea9c193d3a44aa792f4d36 100755
--- a/gcc/testsuite/g++.dg/vect/pr99149.cc
+++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
@@ -11,7 +11,7 @@ public:
   a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
 };
 int f, g;
-class {
+class mp {
   a *h;
   a *i;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 14:56 [PATCH]middle-end Fix trapping access in test PR101750 Tamar Christina
2021-08-04  5:50 ` Richard Biener
2021-08-04 13:34 ` [PATCH][committed]middle-end " Tamar Christina

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).