[Issue 602] Compiler allows a goto statement to skip an initalization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 31 10:31:39 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=602



--- Comment #6 from Martin Nowak <code at dawg.eu> 2013-10-31 10:31:38 PDT ---
Any ideas how to implement this? It seems like an algorithm to distinguish this
is non-trivial.

I tested the following with clang and it gives me a correct warning (gcc 4.7.2
doesn't).
goto.c:3:9:warning: variable 'test' is used uninitialized whenever 'if'
condition is true [-Wsometimes-uninitialized]

int bug(int val)
{
    if (val)
        goto Lno;
    int test = 0;
 Lno: {}
    return test;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list