[llvm-bugs] [Bug 35159] New: Linker command failed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 31 23:00:54 PDT 2017


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

            Bug ID: 35159
           Summary: Linker command failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvm-bugs at lists.llvm.org

$ cat prog.c

#define INT_MAX 0x7fffffff
char a[1][1] = { {1} };
int x = 0;
int y = -INT_MAX;

int main (void)
{
  if (a[x][INT_MAX+y] != 1) __builtin_abort();
  return 0;
}

$ clang-6.0 prog.c

$ clang-6.0 -O1 prog.c
/tmp/prog-b35125.o: In function `main':
prog.c:(.text+0x11): relocation truncated to fit: R_X86_64_32S against symbol
`a' defined in .data section in /tmp/prog-b35125.o
clang-6.0: error: linker command failed with exit code 1 (use -v to see
invocation)

$ clang-6.0 -v
clang version 6.0.0 (trunk 316662) (llvm/trunk 316661)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

Reproduces on clang-3.6 or later with -O1.

-- 
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/20171101/08d80452/attachment.html>


More information about the llvm-bugs mailing list