I am using Intel C++ compiler v15.0 on 64-bit Linux, and I have encountered what appears to be a very annoying bug in icpc. Depending on the order in which input files are passed to icpc, the compiler sometimes outputs bad DWARF debug info, which crashes the debugger. I tickled the bug while working with OpenCV 3.0, but someone on Stack Overflow also encountered it and posted a SSCCE. I have further refined the example and attached it as a ZIP file.
Steps to reproduce:
- Unzip attached sources
- run make
- debug resulting binaries
Expected output:
- Both binaries can be debugged with either gdb or gdb-ia
Actual output:
- debugging Test_good works, but
- debigging Test_bad with either gdb or gdb-ia results in debugger crash:
Reading symbols from ./Test_bad.../build/buildd/gdb-7.7.1/gdb/dwarf2read.c:19061: internal-error: follow_die_offset: Assertion `dwarf2_per_objfile->reading_partial_symbols' failed.
Other considerations:
- Using g++ (replace `icpc` wich `g++` in Makefile) produces debuggable binaries
- For each binary (Test_good/Test_bad) and compiler (icpc/g++), gdb and gdb-ia both exhibit the same behavior. Combined with the previous point, I think this heavily suggests icpc as the culprit.
- Between myself and the Stack Overflow post I linked above, this bug has been reproduced on the following systems:
Linux Mint 17.1 (based on Ubuntu 14.04), 64-bit
icpc version 15.0.0
gdb-ia version 7.7-8.0.524
gdb version 7.7.1
g++ version 4.8.2
OpenSUSE 12.3 64bit
icpc version 15.0.1
gdb version 7.5.1-2.1.1
gdb version 7.8.1
g++ version 4.7.2