[CMake] problem building CMake with clang's -fcatch-undefined-behavior

Sean McBride sean at rogue-research.com
Sat Sep 22 21:57:46 EDT 2012


Hi all,

My dashboards used to build CMake with clang's -fcatch-undefined-behavior, but now they've given it more smarts (to catch more bugs) and now one can't build CMake with this flag.

Here's the build failure:

<http://open.cdash.org/viewBuildError.php?buildid=2562276>

It seems, near the end of the build, that the just-built cpack is run to do something or other.  This process dies:

$ gdb --args ../bin/cpack --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.txt --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.html --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.1 --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.docbook

(gdb) r
Starting program: /Users/builder/external/CMake-clang-dbg-x86_64/bin/cpack --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.txt --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.html --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.1 --help-full /Users/builder/external/CMake-clang-dbg-x86_64/Docs/cpack.docbook
Reading symbols for shared libraries ++++++............................................................ done

Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
0x0000000100fac2e9 in cmsys::Directory::Load (this=0x7fff5fbfba90, name=0x101f51c28 "/Users/builder/external/CMake/Modules/") at /Users/builder/external/CMake/Source/kwsys/Directory.cxx:223
223	    this->Internal->Files.push_back(d->d_name);

(gdb) bt
#0  0x0000000100fac2e9 in cmsys::Directory::Load (this=0x7fff5fbfba90, name=0x101f51c28 "/Users/builder/external/CMake/Modules/") at /Users/builder/external/CMake/Source/kwsys/Directory.cxx:223
#1  0x0000000100fb158e in cmsys::Glob::ProcessDirectory (this=0x7fff5fbfc170, start=0, dir=@0x7fff5fbfbbf0) at /Users/builder/external/CMake/Source/kwsys/Glob.cxx:302
#2  0x0000000100fb451a in cmsys::Glob::FindFiles (this=0x7fff5fbfc170, inexpr=@0x7fff5fbfc168) at /Users/builder/external/CMake/Source/kwsys/Glob.cxx:464
#3  0x0000000100653545 in cmDocumentation::getDocumentedModulesListInDir (this=0x7fff5fbfe8f8, path=@0x7fff5fbfcab8, globExpr=@0x7fff5fbfcab0, docedModuleList=@0x7fff5fbfcae8) at /Users/builder/external/CMake/Source/cmDocumentation.cxx:771
#4  0x000000010000fc9e in main (argc=9, argv=0x7fff5fbff920) at /Users/builder/external/CMake/Source/CPack/cpack.cxx:554

(gdb) p name
$1 = 0x101f51c28 "/Users/builder/external/CMake/Modules/"

(gdb) p *this
$2 = {
  Internal = 0x101f51a80
}

(gdb) p d
$3 = (struct dirent *) 0x102010664

(gdb) p *d
$4 = {
  d_ino = 387485515, 
  d_seekoff = 1769662337112866820, 
  d_reclen = 48, 
  d_namlen = 20, 
  d_type = 8 '\b', 
  d_name = "AutomocInfo.cmake.in\000\000\000\000\000\000\000?\032?\030\000\000\000\000\005\000\000\000?\032?\030D\000+\000\bBasicConfigVersion-AnyNewerVersion.cmake.in\000\000\000\000?\032?\030\000\000\000\000\006\000\000\000?\032?\030D\000(\000\bBasicConfigVersion-ExactVersion.cmake.in\000\000\000\000\000\000\000?\032?\030\000\000\000\000\a\000\000\000???\032H\000,\000\bBasicConfigVersi"...
}

It might be a false positive, though I have yet to see any from this tool.

I'm hoping someone that knows the code can see the problem.

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the CMake mailing list