https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89230

--- Comment #6 from lavr at ncbi dot nlm.nih.gov ---
That said, any function call within the outer "if()" but before the inner
"if()" would cause the warning, even if that call does not accept any pointers
(and thus cannot alias with local "s").  Modifying the code above to include
"fun()" in stead of "printf()", same issue results:

...
void fun(int i)
{
    srand(i);
}

int main(void)
{
    char blk[512], tmp[512];
    struct S *s = (struct S*) blk;
    struct H *h;

    getblk(blk);

    if (s->a  ||  !(h = gethdr(tmp))  ||  s->a != h->d) {
#ifdef BUG
        fun(s->b);
#endif
...

$ gcc -DBUG -O6 -Wall -c bogus2.c
bogus2.c: In function ‘main’:
bogus2.c:47:17: warning: ‘h’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
         else if (!h)
                 ^

Reply via email to