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 <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)