Summary: "Error: variable result used before set" when -release
                    -inline -O
           Product: D
           Version: D2
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Jordi Rovira i Bonet <> 2011-03-28 05:54:10 
PDT ---
When compiling the following code with 

dmd -c -release -inline -O resource.d

I get the message "Error: variable result used before set" without any line
information, and compilation fails.

This happens only with the flags above. Removing any of them, or compiling in
debug results in good output. I have verified that this error happens both in
linux and windows, with dmd 2.052 and since many versions ago. 

Even GDC crashes compiling this code in release, which makes me think it is in
the front end.

I have removed everything i could, and now the code doesn't make much sense,
but the file resource.d is:

module     bug;

import     std.c.string;

class InputStream

    InputStream opShr(T)( out T result )
        memcpy( &result, &m_data[m_pos], T.sizeof );
        m_pos += T.sizeof;

        return this;

    int m_pos;
    const ubyte[] m_data;

struct GUID
    uint m_values[4];

struct Header
    int ver;
    int siz;
    GUID id;

void LoadResourceLegacyHeader( InputStream f, out Header header )
    f >>;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to