Open Quuxplusone opened 7 years ago
Bugzilla Link | PR34830 |
Status | NEW |
Importance | P enhancement |
Reported by | Hans Wennborg (hans@chromium.org) |
Reported on | 2017-10-04 10:30:28 -0700 |
Last modified on | 2017-10-05 22:39:07 -0700 |
Version | trunk |
Hardware | PC Linux |
CC | babokin@gmail.com, jatin.bhateja@gmail.com, llvm-bugs@lists.llvm.org, nicolasweber@gmx.de |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Currently running creduce, but I expect it will take a while because sqlite is a big file.
Here's another repro that also started crashing at that revisions: https://bugs.chromium.org/p/chromium/issues/detail?id=771676#c3
Please check that one too before relanding.
Here's yet another one, this time in 32-bit: https://bugs.chromium.org/p/chromium/issues/detail?id=771673#c3
Reduced test case for the sqlite failure:
typedef struct WalIndexHdr WalIndexHdr;
struct WalIndexHdr {
int iVersion;
char isInit;
int mxFrame;
int aSalt[2];
int aCksum
};
struct Wal {
short readLock;
WalIndexHdr hdr
} walChecksumBytes(int nativeCksum, char *a, nByte, aIn, *aOut) {
int s1, s2, aEnd = &a[nByte];
int *aData = a;
s1 = s2 = 0;
do {
s1 += *aData++ + s2;
s2 += *aData++ + s1;
} while (aData < aEnd);
aOut[1] = s2;
}
sqlite3WalFrames() {
struct Wal *pWal = 0;
int nCksum = __builtin_offsetof(WalIndexHdr, aCksum);
pWal->hdr.iVersion = 07000;
walChecksumBytes(1, &pWal->hdr, nCksum, 0, pWal);
}
$ bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -target-cpu x86-64 -
O2 -w /tmp/a.i
Cannot emit physreg copy instruction
UNREACHABLE executed at ../lib/Target/X86/X86InstrInfo.cpp:6750!
#0 0x000000000215ee7a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(bin/clang+0x215ee7a)
#1 0x000000000215ceee llvm::sys::RunSignalHandlers() (bin/clang+0x215ceee)
#2 0x000000000215d052 SignalHandler(int) (bin/clang+0x215d052)
#3 0x00007f4c651e8330 __restore_rt (/lib/x86_64-linux-
gnu/libpthread.so.0+0x10330)
#4 0x00007f4c63fd8c37 gsignal /build/eglibc-SvCtMH/eglibc-
2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f4c63fdc028 abort /build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#6 0x000000000210def5 (bin/clang+0x210def5)
#7 0x0000000001695bd8 llvm::X86InstrInfo::copyPhysReg(llvm::MachineBasicBlock&,
llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc
const&, unsigned int, unsigned int, bool) const (bin/clang+0x1695bd8)
#8 0x0000000001b76b17 (anonymous
namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&)
(bin/clang+0x1b76b17)
#9 0x00000000019ecc05 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(bin/clang+0x19ecc05)
#10 0x0000000001cfd7a3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(bin/clang+0x1cfd7a3)
#11 0x0000000001cfd84c llvm::FPPassManager::runOnModule(llvm::Module&)
(bin/clang+0x1cfd84c)
#12 0x0000000001cfe5ef llvm::legacy::PassManagerImpl::run(llvm::Module&)
(bin/clang+0x1cfe5ef)
#13 0x00000000022ee5ae (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) (bin/clang+0x22ee5ae)
#14 0x00000000022ef88f clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) (bin/clang+0x22ef88f)
#15 0x00000000029e75bb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(bin/clang+0x29e75bb)
#16 0x0000000002de7a62 clang::ParseAST(clang::Sema&, bool, bool)
(bin/clang+0x2de7a62)
#17 0x00000000029e6bff clang::CodeGenAction::ExecuteAction()
(bin/clang+0x29e6bff)
#18 0x0000000002693996 clang::FrontendAction::Execute() (bin/clang+0x2693996)
#19 0x000000000266b33e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(bin/clang+0x266b33e)
#20 0x000000000272489b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (bin/clang+0x272489b)
#21 0x0000000000bde4f8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (bin/clang+0xbde4f8)
#22 0x0000000000b74384 main (bin/clang+0xb74384)
#23 0x00007f4c63fc3f45 __libc_start_main /build/eglibc-SvCtMH/eglibc-
2.19/csu/libc-start.c:321:0
#24 0x0000000000bd9ae9 _start (bin/clang+0xbd9ae9)
Stack dump:
0. Program arguments: bin/clang -cc1 -triple x86_64-unknown-linux-gnu -
emit-obj -target-cpu x86-64 -O2 -w /tmp/a.i
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/tmp/a.i'.
4. Running pass 'Post-RA pseudo instruction expansion pass' on function
'@sqlite3WalFrames'
Aborted (core dumped)
Two more handy reproducers:
> cat f1.cpp
char a, b;
int c, d, e;
short f;
void g() {
f = !a &&
(d - 1) * e + (!(c << 2048 - 2032) == a) - 13906 -
-(!(c << 2048 - 2032) == 0) >=
(d - 1) * e + (!(c << 2048 - 2032) == a) - 13906 - b;
}
> cat f2.cpp
bool a;
char b, f, c, d;
int e, g;
void h() {
if (b * (-(8 - c - (f % 4 && a - b)) + (f % 4 && a - b)))
d = g;
e = -(8 - c - (f % 4 && a - b));
}
To compile just run -O2 compilation.