Hello,
On Mon, 13 Sep 2021, Aldy Hernandez via Gcc-patches wrote:
The testcase still tests what it's supposed to test with ...
> > typedef unsigned short uint16_t;
> >
> > uint16_t a, b;
> >
> > int *j_global;
> > uint16_t f(void)
> > {
> > int c, **p;
> > short d = 2, e = 4;
> >
... "c = a;" added here (i.e. it still hangs before the pr55107 change).
> > for (;; b++)
> > {
> > int *j = j_global, k = 0;
> >
> > for (; *j; j++)
> > {
> > for(; c; c++)
> > for(; k < 1; k++)
> > {
> > short *f = &d;
> >
> > if(b)
> > return *f;
> > }
> > }
> >
> > if(!c)
> > d *= e;
> >
> > a = d;
> > if ((a ? b = 0 : (**p ? : 1) != (d != 1 ? 1 : (b = 0))) != ((k ? a
> : 0)
> > < (a * (c = k))))
> > **p = 0;
> > }
> > }
> >
>
> Thanks for getting rid of the noise here.
>
> I've simplified the above to show what's going on in the warning on
> nds32-elf:
>
> int george, *global;
> int stuff(), readme();
>
> int
> f (void)
> {
> int store;
>
> for (;;)
> {
> int k = 0;
>
> while (global)
> {
> for (; store; ++store)
Yeah, that seems a correct warning, your 'store' (the 'c' in the original
testcase) is really used uninitialized (when 'global' aka '*j_global' is
non-zero). Sorry for not noticing earlier, I was only getting rid of
warnings, not carefully looking at the testcase itself. I think with
above initialization of 'c' it's conforming, and still a correct test for
the original bug.
> This looks like a latent bug. For that matter, the above snippet warns
> with -fdisable-tree-thread2, even on x86-64 (and before my patch).
Ciao,
Michael.