Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang crashes on x86_64-linux-gnu at O1 and above in 32-bit and 64-bit modes (Assertion `Offset <= PieceOffset && "overlapping or duplicate pieces"' failed) #26522

Closed
chengniansun opened this issue Jan 15, 2016 · 9 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@chengniansun
Copy link

Bugzilla Link 26148
Resolution FIXED
Resolved on Feb 06, 2016 23:25
Version trunk
OS All
Blocks #26433
CC @chengniansun,@majnemer,@emaste,@zmodem,@Keno,@zhendongsu

Extended Description

The following code crashes clang trunk at -O1 and above in both 32-bit and 64-bit modes.

$: clang-trunk -v
clang version 3.9.0 (trunk 257643)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3
Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.4
Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@MX32
Selected multilib: .;@m64
$:
$: clang-trunk -O1 -g small.c
clang: /tmp/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1561: void llvm::DebugLocEntry::finalize(const llvm::AsmPrinter &, DebugLocStream::ListBuilder &, const llvm::DIBasicType ): Assertion `Offset <= PieceOffset && "overlapping or duplicate pieces"' failed.
0 clang 0x0000000003095008 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 clang 0x0000000003095777
2 libpthread.so.0 0x00007f7473224340
3 libc.so.6 0x00007f747222ecc9 gsignal + 57
4 libc.so.6 0x00007f74722320d8 abort + 328
5 libc.so.6 0x00007f7472227b86
6 libc.so.6 0x00007f7472227c32
7 clang 0x000000000265c65a llvm::DebugLocEntry::finalize(llvm::AsmPrinter const&, llvm::DebugLocStream::ListBuilder&, llvm::DIBasicType const
) + 906
8 clang 0x000000000265bde7 llvm::DwarfDebug::collectVariableInfo(llvm::DwarfCompileUnit&, llvm::DISubprogram const*, llvm::DenseSet<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*>, llvm::DenseMapInfo<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*> > >&) + 1063
9 clang 0x000000000265dd90 llvm::DwarfDebug::endFunction(llvm::MachineFunction const*) + 352
10 clang 0x000000000263e231 llvm::AsmPrinter::EmitFunctionBody() + 7025
11 clang 0x0000000002318b98
12 clang 0x000000000273e089 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 153
13 clang 0x0000000002fd90d4 llvm::FPPassManager::runOnFunction(llvm::Function&) + 564
14 clang 0x0000000002fd931b llvm::FPPassManager::runOnModule(llvm::Module&) + 43
15 clang 0x0000000002fd97e5 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 869
16 clang 0x0000000000a168dd clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) + 9693
17 clang 0x00000000009f6f38
18 clang 0x0000000000cab776 clang::ParseAST(clang::Sema&, bool, bool) + 582
19 clang 0x0000000000789d35 clang::FrontendAction::Execute() + 69
20 clang 0x0000000000752d91 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1153
21 clang 0x00000000007318dc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3068
22 clang 0x00000000007277a8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1176
23 clang 0x000000000072ff93 main + 12707
24 libc.so.6 0x00007f7472219ec5 __libc_start_main + 245
25 clang 0x0000000000727234
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir /data2/c-hunter-results/C/instrument-bugs/REDUCED/20160114-clang-trunk-m64-g-O3-build-051234/delta -ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-ee55a9.o -x c small.c

  1.  <eof> parser at end of file
    
  2.  Code generation
    
  3.  Running pass 'Function Pass Manager' on module 'small.c'.
    
  4.  Running pass 'X86 Assembly / Object Emitter' on function '@fn1'
    

clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.9.0 (trunk 257643)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-e5dff4.c
clang: note: diagnostic msg: /tmp/small-e5dff4.sh
clang: note: diagnostic msg:


$:
$: cat small.c
struct S0 {
int f0;
short f5;
} b;
static int a;
void fn1(char p1) {
struct S0 c = {3};
if (a)
b = c;
c.f0 = p1;
}

int main() { return 0; }
$:

@majnemer
Copy link
Mannequin

majnemer mannequin commented Jan 25, 2016

*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#26163 ***

@chengniansun
Copy link
Author

*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#26163 ***

Hi David,

This bug was reported one day earlier than llvm/llvm-bugzilla-archive#26163 . May I know why this bug was resolved as a duplicate of that one?

@majnemer
Copy link
Mannequin

majnemer mannequin commented Jan 25, 2016

*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#26163 ***

Hi David,

This bug was reported one day earlier than llvm/llvm-bugzilla-archive#26163 . May I know why this bug
was resolved as a duplicate of that one?

llvm/llvm-bugzilla-archive#26163 was already marked as fixed, I figured that marking #26522 as duplicate would generate less email than marking #26522 as fixed and llvm/llvm-bugzilla-archive#26163 as the duplicate. This would also be a little weird to anyone investigating the chronology of r257979 seeing as how it refers to llvm/llvm-bugzilla-archive#26163 , not #26522 .

@chengniansun
Copy link
Author

I encounter this bug again. As the test case is similar to what I have reported, so I just reopen this bug report.

$: clang-trunk -v
clang version 3.9.0 (trunk 259077) (llvm/trunk 259085)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@MX32
Selected multilib: .;@m64
$:
$: clang-trunk -g -O3 small.c
clang-3.9: /tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1579: void llvm::DebugLocEntry::finalize(const llvm::AsmPrinter&, llvm::DebugLocStream::ListBuilder&, const llvm::DIBasicType*): Assertion `Offset <= PieceOffset && "overlapping or duplicate pieces"' failed.
0 clang-3.9 0x0000000001a73fe5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 clang-3.9 0x0000000001a71d76 llvm::sys::RunSignalHandlers() + 54
2 clang-3.9 0x0000000001a71fa1
3 libpthread.so.0 0x00007f0db017b340
4 libc.so.6 0x00007f0daf32bcc9 gsignal + 57
5 libc.so.6 0x00007f0daf32f0d8 abort + 328
6 libc.so.6 0x00007f0daf324b86
7 libc.so.6 0x00007f0daf324c32
8 clang-3.9 0x0000000001f0da0c llvm::DebugLocEntry::finalize(llvm::AsmPrinter const&, llvm::DebugLocStream::ListBuilder&, llvm::DIBasicType const*) + 1148
9 clang-3.9 0x0000000001f15b96 llvm::DwarfDebug::collectVariableInfo(llvm::DwarfCompileUnit&, llvm::DISubprogram const*, llvm::DenseSet<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*>, llvm::DenseMapInfo<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*> > >&) + 918
10 clang-3.9 0x0000000001f15fb1 llvm::DwarfDebug::endFunction(llvm::MachineFunction const*) + 241
11 clang-3.9 0x0000000001ef85f8 llvm::AsmPrinter::EmitFunctionBody() + 1720
12 clang-3.9 0x0000000001142526
13 clang-3.9 0x000000000173aa73 llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
14 clang-3.9 0x000000000173ae2b llvm::FPPassManager::runOnModule(llvm::Module&) + 43
15 clang-3.9 0x000000000173b13f llvm::legacy::PassManagerImpl::run(llvm::Module&) + 751
16 clang-3.9 0x0000000001b929bc clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) + 3660
17 clang-3.9 0x0000000002108b03
18 clang-3.9 0x000000000240b86b clang::ParseAST(clang::Sema&, bool, bool) + 571
19 clang-3.9 0x0000000002108bee clang::CodeGenAction::ExecuteAction() + 78
20 clang-3.9 0x0000000001e64f56 clang::FrontendAction::Execute() + 534
21 clang-3.9 0x0000000001e41e1e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 318
22 clang-3.9 0x0000000001ee7b1a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2090
23 clang-3.9 0x00000000009bf798 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2344
24 clang-3.9 0x000000000097ca85 main + 6213
25 libc.so.6 0x00007f0daf316ec5 __libc_start_main + 245
26 clang-3.9 0x00000000009bb7f4
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -c-isystem . -c-isystem /usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/ -internal-isystem /usr/local/include -internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir /home/cnsun/ramdisk/speculative-execution/run-7/res/20160128-clang-trunk-m32-g-O3-build-074207/delta -ferror-limit 19 -fmessage-length 261 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /home/cnsun/ramdisk/tmp/small-68d5fe.o -x c small.c

  1.  <eof> parser at end of file
    
  2.  Code generation
    
  3.  Running pass 'Function Pass Manager' on module 'small.c'.
    
  4.  Running pass 'X86 Assembly / Object Emitter' on function '@fn1'
    

clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.9.0 (trunk 259077) (llvm/trunk 259085)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-3.9: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /home/cnsun/ramdisk/tmp/small-f859c3.c
clang-3.9: note: diagnostic msg: /home/cnsun/ramdisk/tmp/small-f859c3.sh
clang-3.9: note: diagnostic msg:


$: cat small.c
struct S0 {
short f0;
int f3;
} a;
void fn1(short p1) {
struct S0 b, c = {3};
b.f3 = p1;
a = b = c;
}

int main() { return 0; }
$:

@zmodem
Copy link
Collaborator

zmodem commented Jan 29, 2016

+Keno who looked at llvm/llvm-bugzilla-archive#26163

@Keno
Copy link
Member

Keno commented Jan 29, 2016

Thanks, I'll take a look tomorrow.

@Keno
Copy link
Member

Keno commented Jan 30, 2016

Patch at http://reviews.llvm.org/D16742.

@Keno
Copy link
Member

Keno commented Feb 7, 2016

Landed as r259696. Which reminds me that this probably needs to be put on the release branch if it hasn't already.

@majnemer
Copy link
Mannequin

majnemer mannequin commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#26163

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants