[llvm-bugs] [Bug 44366] New: Error when compiling large `if` blocks on riscv64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 22 20:40:24 PST 2019


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

            Bug ID: 44366
           Summary: Error when compiling large `if` blocks on
                    riscv64-linux-gnu
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: adrien.sf.wu at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

When compiling a program to riscv64-linux-gnu target with large "if" blocks
(which compiles to at least 2^19 bytes of code to make the jump an indirect
branch), clang gives the following error:

  error in backend: Unable to insert indirect branch

It seems like a issue on PIE generation, since compiling with --target=riscv64
is successful.

The following is an example source:

int a(int c) {
  if (c < 12345) {
#define A \
    { int d = c % 12345; int e = c ^ d * 12345; \
      int f = c * d % e % 12345; c = f; }
#define B A A A A A A
#define C B B B B B B
#define D C C C C C C
#define E D D D D D D
    E E E E E
  }
  return c;
}

One can reproduce the error by compiling the source with
  clang -O0 --target=riscv64-linux-gnu -c

-- 
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/20191223/72053216/attachment.html>


More information about the llvm-bugs mailing list