[LLVMbugs] [Bug 20432] New: call using struct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 24 01:22:36 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20432

            Bug ID: 20432
           Summary: call using struct
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: troshkovdanil at mail.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

test2.c:

#include <stdio.h>

typedef struct{
  char x[0];
} X;

int f(X x, X y) {
  return x.x[0] + y.x[0];
}

int main() {
  X xxx;
  xxx.x[0] = '0'; // '0' == 0x30
  if(f(xxx, xxx) == 0x60) {
    printf("ok\n");
    return 0;
  }
  printf("error\n");
  return 1;
}


[dtroshkov at diver test]$ gcc test2.c 
[dtroshkov at diver test]$ ./a.out 
ok
[dtroshkov at diver test]$ /home/dtroshkov/build/Debug+Asserts/bin/clang test2.c 
[dtroshkov at diver test]$ ./a.out 
error
[dtroshkov at diver test]$ /home/dtroshkov/build/Debug+Asserts/bin/clang -v
test2.c 
clang version 3.5.0 (trunk 213767)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/home/dtroshkov/build/Debug+Asserts/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
test2.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.23.52.0.1 -v -dwarf-column-info -resource-dir
/home/dtroshkov/build/Debug+Asserts/bin/../lib/clang/3.5.0 -internal-isystem
/usr/local/include -internal-isystem
/home/dtroshkov/build/Debug+Asserts/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/dtroshkov/test -ferror-limit 19 -fmessage-length
80 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/test2-8b6d77.o -x c test2.c
clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/dtroshkov/build/Debug+Asserts/bin/../lib/clang/3.5.0/include
 /usr/include
End of search list.
 "/opt/rh/devtoolset-2/root/usr/bin/ld" --eh-frame-hdr -m elf_x86_64
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../..
-L/home/dtroshkov/build/Debug+Asserts/bin/../lib -L/lib -L/usr/lib
/tmp/test2-8b6d77.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crtn.o

-- 
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/20140724/6f823d41/attachment.html>


More information about the llvm-bugs mailing list