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: unassignedclangb...@nondot.org
          Reporter: adrien.sf...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to