[llvm-bugs] [Bug 25309] New: Miscompilation with K&R function prototype

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 24 17:28:35 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25309

            Bug ID: 25309
           Summary: Miscompilation with K&R function prototype
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: anton at samba.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

creduce gave me the following cut down testcase:

#include <assert.h>

static int i;
static int *volatile m = &i, *o = &i;

static void zot(void)
{
        assert(*o);
}

void blah() { }

int main(void)
{
        *o = 0;
        *m = 1;
        blah(&o);
        zot();

        return 0;
}

I was somewhat surprised clang accepts K&R function prototypes, but it does,
and we miscompile the testcase at -O2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151025/78a2188b/attachment.html>


More information about the llvm-bugs mailing list