Skip to content

Assertion failed: (ScaledReg == nullptr), function SetCombinedField, file lib/CodeGen/CodeGenPrepare.cpp, line 1973. #35153

@DimitryAndric

Description

@DimitryAndric
Bugzilla Link 35805
Resolution DUPLICATE
Resolved on Jan 24, 2018 14:27
Version trunk
OS All
Depends On #35430
Blocks #35152
CC @emaste,@serguei-katkov

Extended Description

As reported in https://bugs.freebsd.org/224866, clang 6.0.0 (trunk r321545) asserts on compiling colset.c of the graphics/xpx port:

Starting program: /usr/bin/clang -cc1 -triple x86_64-unknown-freebsd12.0 -emit-obj -disable-free -main-file-name colset.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /wrkdirs/usr/ports/graphics/xpx/work/xpx/colset.gcno -D CSRG_BASED -D FUNCPROTO=15 -D NARROWPROTO -O2 -ferror-limit 19 -fmessage-length 101 -stack-protector 1 -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -x c colset-bf0c31.c
Assertion failed: (ScaledReg == nullptr), function SetCombinedField, file /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp, line 1973.

Program received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:3
3 in thr_kill.S
(gdb) bt
#​0 thr_kill () at thr_kill.S:3
#​1 0x00000000041090bf in __raise (s=6) at /share/dim/src/freebsd/clang600-import/lib/libc/gen/raise.c:54
#​2 0x0000000004109039 in abort () at /share/dim/src/freebsd/clang600-import/lib/libc/stdlib/abort.c:67
#​3 0x000000000417864a in __assert (func=, file=, line=, failedexpr=) at /share/dim/src/freebsd/clang600-import/lib/libc/gen/assert.c:53
#​4 0x000000000398ede4 in SetCombinedField () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:1973
#​5 combineAddrModes () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:2754
#​6 0x0000000003984b80 in optimizeMemoryInst () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:4251
#​7 0x000000000397ddd9 in optimizeInst () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:6228
#​8 0x0000000003976497 in optimizeBlock () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:6335
#​9 runOnFunction () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp:420
#​10 0x000000000374326a in runOnFunction () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/IR/LegacyPassManager.cpp:1520
#​11 0x0000000003743553 in runOnModule () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/IR/LegacyPassManager.cpp:1541
#​12 0x0000000003743a82 in runOnModule () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/IR/LegacyPassManager.cpp:1597
#​13 run () at /share/dim/src/freebsd/clang600-import/contrib/llvm/lib/IR/LegacyPassManager.cpp:1700
#​14 0x00000000015c9518 in EmitAssembly () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:815
#​15 EmitBackendOutput () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1181
#​16 0x00000000015c3894 in HandleTranslationUnit () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:292
#​17 0x0000000001fbd372 in ParseAST () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/Parse/ParseAST.cpp:159
#​18 0x00000000019d236e in Execute () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:897
#​19 0x00000000027b7b71 in ExecuteAction () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:991
#​20 0x00000000015a1a33 in ExecuteCompilerInvocation () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252
#​21 0x00000000015967d0 in cc1_main () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/tools/driver/cc1_main.cpp:221
#​22 0x000000000159effa in ExecuteCC1Tool () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/tools/driver/driver.cpp:309
#​23 main () at /share/dim/src/freebsd/clang600-import/contrib/llvm/tools/clang/tools/driver/driver.cpp:388

The test case minimizes to:

/* clang -cc1 -triple x86_64 -S -O1 colset-minimized.c */
int h;
void k();
typedef struct {
struct {
unsigned char b;
unsigned char c;
} d;
} e;
typedef struct { short f; } g;
e j;
void n(g *l)
{
int i, m;
e a = *(&j + h);
switch (l->f) {
case 4:
i = 0;
m = a.d.b;
break;
case 5:
i = 1;
m = a.d.c;
}
k((long)i, m);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions