[LLVMbugs] [Bug 18789] New: va_copy for AArch64 doesn't work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 10 01:05:31 PST 2014


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

            Bug ID: 18789
           Summary: va_copy for AArch64 doesn't work
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: liujiangning1 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12036
  --> http://llvm.org/bugs/attachment.cgi?id=12036&action=edit
The .ll file to reproduce the run-time failure

The attached test case t.c is from LNT

$ cat t.c
#include <stdio.h>
#include <stdarg.h>

void testVaCopyArg(char *fmt, ...) {
  va_list ap, aq;
  char *s;
  va_start(ap, fmt);
  va_copy(aq, ap);    /* test va_copy */

  s = va_arg(aq, char *);
  printf("string %s\n", s);
}

int main() {
  testVaCopyArg("s", "abc");
  return 0;
}

It fails at run-time with -O1 and above for aarch64 target, and it can pass
with -O0.

t.ll is generated with the following command line,

clang -O3 --target=aarch64-linux-gnuabi -mfpu=neon t.c -S -emit-llvm

With t.ll, we can confirm the bug is from backend, because the binary built
from "llc -O1" fail, while the binary built from "llc -O0" can pass.

1) -O0 case
// build with the following command line
llc -mtriple=aarch64-none-linux-gnueabi -O0 t.ll
clang --target=aarch64-linux-gnuabi t.s
// running a.out on foundation model shows correct result.

2) -O1 case
// build with the following command line
llc -mtriple=aarch64-none-linux-gnueabi -O1 t.ll
clang --target=aarch64-linux-gnuabi t.s
// running a.out on foundation model shows incorrect result or segmentation
fault.

-- 
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/20140210/2f2e6b08/attachment.html>


More information about the llvm-bugs mailing list