<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Linker command failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=35159">35159</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linker command failed
          </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>ishiura-compiler@ml.kwansei.ac.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.</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>