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

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Thanks for the reference, but it doesn't help. Something more subtle is going
on, because placing the shift-add combo in a separate function makes Valgrind
properly compute known bits even without the magic flag. Here's a testcase:

__attribute__((noipa))
static int f(short *s)
{
        return s[0] + (s[1] << 16);
}

int main()
{
        void *p = __builtin_malloc(64);
        *(char *)p = 1;
        asm("" ::: "memory");
        if (!f(p))
                __builtin_abort();
}

Compile with gcc -O2 and run under valgrind. Then comment out the attribute,
recompile (gcc will inline the function) and run again — valgrind will complain

==2617== Conditional jump or move depends on uninitialised value(s)
==2617==    at 0x10908D: main (t.c:12)

Reply via email to