Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang musttail crash on arm32 #50383

Open Quuxplusone opened 2 years ago

Quuxplusone commented 2 years ago
Bugzilla Link PR51416
Status NEW
Importance P enhancement
Reported by Manoj Gupta (manojgupta@google.com)
Reported on 2021-08-09 09:39:06 -0700
Last modified on 2021-08-09 15:42:59 -0700
Version trunk
Hardware PC All
CC htmldeveloper@gmail.com, jhaberman@gmail.com, kristof.beyls@gmail.com, llozano@chromium.org, llvm-bugs@lists.llvm.org, manojgupta@google.com, neeilans@live.com, richard-llvm@metafoo.co.uk, smithp352@googlemail.com, srhines@google.com, Ties.Stuij@arm.com, yabinc@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
A new feture in clang [[msuttail]] is causing clang to cash on our internal
builds.

Reduced test case:

typedef long a;
typedef short b;
typedef long long c;
class d;
class e;
struct f {};
struct g;
class h {
public:
  enum i { j };
};
template <unsigned> struct k : h {
  static char *l(d *, const char *, e *, const g *, c, f);
  template <typename, typename, i>
  static const char *m(d *, const char *, e *, const g *, c, f);
};
template <unsigned n>
template <typename, typename, h::i>
const char *k<n>::m(d *o, const char *p, e *p3, const g *q, c r, f s) {
  [[clang::musttail]] return l(o, p, p3, q, r, s);
}
template const char *k<1>::m<a, b, h::j>(d *, const char *, e *, const g *, c,
                                         f);
clang++ -target armv7a-linux-gnueabihf -mfpu=neon tctable_lite.cpp -c

fatal error: error in backend: failed to perform tail call elimination on a
call site marked musttail
PLEASE submit a bug report to https://crbug.com and run
tools/clang/scripts/process_crashreports.py (only works inside Google) which
will upload a report and include the crash backtrace, preprocessed source, and
associated run script.
Stack dump:
0.  Program arguments:
/usr/local/google/home/manojgupta/chromeclang/third_party/llvm-
build/Release+Asserts/bin/clang++ -target armv7a-linux-gnueabihf -mfpu=neon
generated_message_tctable_lite-b3fd7e.cpp -c
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module
'generated_message_tctable_lite-b3fd7e.cpp'.
4.  Running pass 'ARM Instruction Selection' on function
'@_ZN1kILj1EE1mIlsLN1h1iE0EEEPKcP1dS5_P1ePK1gx1f'
#0 0x00000000033130b8

clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project/
7d9d926a1861e2f6876943d47f297e2a08a57392)
Target: armv7a-unknown-linux-gnueabihf

Still repros on ToT.
Quuxplusone commented 2 years ago
Further reduced:

char *l(int, int, int, long long);
char *m(int a, int b, int c, long long d) {
  [[clang::musttail]] return l(a, b, c, d);
}

Godbolt link: https://godbolt.org/z/81jbn5oEr

Note that the error goes away with -O: https://godbolt.org/z/MrvoT7c4P

This seems like an issue with the ARM backend.