<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - call using struct"
   href="http://llvm.org/bugs/show_bug.cgi?id=20432">20432</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>call using struct
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>troshkovdanil@mail.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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@diver test]$ gcc test2.c 
[dtroshkov@diver test]$ ./a.out 
ok
[dtroshkov@diver test]$ /home/dtroshkov/build/Debug+Asserts/bin/clang test2.c 
[dtroshkov@diver test]$ ./a.out 
error
[dtroshkov@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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>