<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 - [M68k] Code selection failed with string length greater than or equal to 4"
   href="https://bugs.llvm.org/show_bug.cgi?id=52516">52516</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[M68k] Code selection failed with string length greater than or equal to 4
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Backend: M68k
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>t104360003@ntut.org.tw
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>glaubitz@physik.fu-berlin.de, llvm-bugs@lists.llvm.org, minyihh@uci.edu
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25450" name="attach_25450" title="Preprocessed source">attachment 25450</a> <a href="attachment.cgi?id=25450&action=edit" title="Preprocessed source">[details]</a></span>
Preprocessed source

This is the code that triggered this error:

void test(char *s)
{
}

int main()
{
  char s[] = "123";
  test(s);
  return 0;
}

This is the error message:
$ clang -ccc-gcc-name linux-gnu-gcc --target=m68k tmp.c -o tmp
fatal error: error in backend: Cannot select: t47: i32,ch =
load<(dereferenceable load (s8) from `i8* getelementptr inbounds ([4 x i8], [4
x i8]* @__const.main.s, i32 0, i32 0)` + 1), zext from i8> t4, t46, undef:i32
  t46: i32 = add nuw t34, Constant:i32<1>
    t34: i32 = M68kISD::WrapperPC TargetGlobalAddress:i32<[4 x i8]*
@__const.main.s> 0
      t33: i32 = TargetGlobalAddress<[4 x i8]* @__const.main.s> 0
    t36: i32 = Constant<1>
  t3: i32 = undef
In function: main
clang-14: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
7f7cab6bb1d48b53e1fa9ab5a4fd7bcf7f00f19b)
Target: m68k
Thread model: posix
InstalledDir: /home/sheng/project/compiler/llvm_m68k/build/bin
clang-14: note: diagnostic msg:

---

Here's my environment:

$ clang-v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
7f7cab6bb1d48b53e1fa9ab5a4fd7bcf7f00f19b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/sheng/project/compiler/llvm_m68k/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>