[LLVMbugs] [Bug 20045] New: Incorrect code of variable arguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 14 22:04:27 PDT 2014


            Bug ID: 20045
           Summary: Incorrect code of variable arguments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang 3.5.0 (based on LLVM 3.5svn) for x86_64 target miscompiles the following

    % cat error.c

    #include <stdarg.h>

    struct S { float m0[2]; int m1; };

    void func1( int fx, ... )
        struct S fs;

        va_list ap;
        va_start(ap, fx);
        fs = va_arg(ap, struct S);

        if( fs.m1 != 1 ) { __builtin_abort(); }

    int main( void )
        int x = 1;

        struct S s = {{1.0F,1.0F},1};
        func1(x, s);

        return 0;

    % clang error.c

    % ./a.out
    zsh: abort      ./a.out

    % clang -v
    clang version 3.5.0 (trunk 210625)
    Target: x86_64-apple-darwin13.2.0
    Thread model: posix

The value of fs.m1 was 1065353216 instead of 1.

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/20140615/3751644f/attachment.html>

More information about the llvm-bugs mailing list