[llvm-bugs] [Bug 25931] New: WebAssembly miscompiles global structs with multiple data members

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 22 17:07:36 PST 2015


            Bug ID: 25931
           Summary: WebAssembly miscompiles global structs with multiple
                    data members
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: jfb at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

(filing under lib/CodeGen, since we don't have a component for WebAssembly at
the moment)

The following GCC torture test:

Has the following code:

struct {
  char a1c;
  char *a1p;
} a1 = {

struct {
  char a2c;
  char a2p[2];
} a2 = {

/* The tests.  */
struct {
  char a3c;
  char a3p[];
} a3 = {

struct {
  char a4c;
  char a4p[];
} a4 = {
  { 'e', 'b' }

Which WebAssembly's backend miscompiles as:

    .asciz    "62"
    .size    .str, 3

    .type    a1, at object              # @a1
    .globl    a1
    .align    2
    .int8    52                      # 0x34
    .zero    3
    .int32    .str
    .size    a1, 8

    .type    a2, at object              # @a2
    .globl    a2
    .int8    118                     # 0x76
    .ascii    "cq"
    .size    a2, 3

    .type    a3, at object              # @a3
    .globl    a3
    .int8    111                     # 0x6f
    .asciz    "wx"
    .size    a3, 4

    .type    a4, at object              # @a4
    .globl    a4
    .int8    57                      # 0x39
    .ascii    "eb"
    .size    a4, 3

Note the missing initialization (but surprisingly, correct size!).

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/20151223/eff647e7/attachment.html>

More information about the llvm-bugs mailing list