[llvm-bugs] [Bug 26337] New: extern "C" void fun(struct dummy, struct foo) doesn't always work

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 05:25:51 PST 2016


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

            Bug ID: 26337
           Summary: extern "C" void fun(struct dummy, struct foo) doesn't
                    always work
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

On x86-64, I got

[hjl at gnu-6 empty-1]$ cat emptya.c
#include "empty.h"
void fun(struct dummy d, struct foo f)
{
  if (f.i1 != -1)
    __builtin_abort();
}
[hjl at gnu-6 empty-1]$ cat empty.cc
#include "empty.h"
extern "C" void fun(struct dummy, struct foo);

int main()
{
  struct dummy d;
  struct foo f = { -1, -2, -3, -4, -5 };

  fun(d, f);
  return 0;
}
[hjl at gnu-6 empty-1]$ cat empty.h
#ifdef __x86_64__
# ifndef PAD_SIZE
#  define PAD_SIZE 16
# endif
struct dummy0 { };
struct dummy { struct dummy0 d[PAD_SIZE]; };
#else
# ifndef PAD_SIZE
struct dummy { };
# else
struct dummy0 { };
struct dummy { struct dummy0 d[1]; };
# endif
#endif

struct foo
{
  int i1;
  int i2;
  int i3;
  int i4;
  int i5;
};
[hjl at gnu-6 empty-1]$ make
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -c -O emptya.c
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -m32 -c -O empty.cc
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -o x emptya.o
empty.o
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -c -O -o
empty1a.o emptya.c -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -m32 -c -O -o
empty1.o  empty.cc -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -o y empty1a.o
empty1.o
./x
./y
Makefile:17: recipe for target 'all' failed
make: *** [all] Aborted
[hjl at gnu-6 empty-1]$ make
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -c -O emptya.c
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -c -O empty.cc
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -o x emptya.o empty.o
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -c -O -o empty1a.o
emptya.c -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -c -O -o empty1.o 
empty.cc -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -o y empty1a.o
empty1.o
./x
./y
Makefile:17: recipe for target 'all' failed
make: *** [all] Aborted
[hjl at gnu-6 empty-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/20160127/8372604e/attachment.html>


More information about the llvm-bugs mailing list