[MacPorts] #58442: clang-7, 8.0 - seg. faults when used as assembler with assertions variant active.

MacPorts noreply at macports.org
Fri May 10 20:17:37 UTC 2019


#58442: clang-7,8.0 - seg. faults when used as assembler with assertions variant
active.
----------------------------------+--------------------
  Reporter:  mouse07410           |      Owner:  (none)
      Type:  defect               |     Status:  new
  Priority:  Normal               |  Milestone:
 Component:  ports                |    Version:
Resolution:                       |   Keywords:
      Port:  clang-7.0 clang-8.0  |
----------------------------------+--------------------

Comment (by mouse07410):

 Oh, I figure you want a **simple** reproducer?

 How about this:
 1. Set LLVM to one of the Macports LLVMs (e.g., {{{sudo port select --set
 llvm mp-llvm-8.0}}})
 2. Do {{{g++ -g -o GenConfigInfo GenConfigInfo.cpp}}}
 3. Observe/enjoy the following output:

 {{{
 $ port select --list llvm
 Available versions for llvm:
         mp-llvm-6.0
         mp-llvm-7.0
         mp-llvm-8.0 (active)
         none
 $ port select --list gcc
 Available versions for gcc:
         mp-gcc8
         mp-gcc9 (active)
         none
 $ g++ -g -o GenConfigInfo GenConfigInfo.cpp
 Assertion failed: (!CreatedADWARFSection && "Creating regular section
 after DWARF"), function ChangeSection, file
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-7.0/llvm-7.0/work/llvm-7.0.1.src/lib/MC/MCMachOStreamer.cpp,
 line 159.
 Stack dump:
 0.      Program arguments: /opt/local/libexec/llvm-7.0/bin/clang -cc1as
 -triple x86_64-apple-macosx10.14.0 -filetype obj -main-file-name
 cc8IygJS.s -target-cpu penryn -fdebug-compilation-dir
 /Users/ur20980/src/ntl-11.3.2/src -dwarf-debug-producer clang version
 7.0.1 (tags/RELEASE_701/final) -dwarf-version=4 -mrelocation-model pic -o
 /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T//ccLrUU5b.o
 /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T//cc8IygJS.s
 0  libLLVM.dylib            0x000000010d3f78b0
 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
 1  libLLVM.dylib            0x000000010d3f7ca1 SignalHandler(int) + 200
 2  libsystem_platform.dylib 0x00007fff7fad1b5d _sigtramp + 29
 3  libsystem_platform.dylib 0x0000000119821938 _sigtramp + 2580872696
 4  libsystem_c.dylib        0x00007fff7f9916a6 abort + 127
 5  libsystem_c.dylib        0x00007fff7f95a20d basename_r + 0
 6  libLLVM.dylib            0x000000010dfd7479 (anonymous
 namespace)::MCMachOStreamer::ChangeSection(llvm::MCSection*, llvm::MCExpr
 const*) + 793
 7  libLLVM.dylib            0x000000010dfe4b89
 llvm::MCStreamer::SwitchSection(llvm::MCSection*, llvm::MCExpr const*) +
 97
 8  libLLVM.dylib            0x000000010e01bdab (anonymous
 namespace)::DarwinAsmParser::parseSectionSwitch(llvm::StringRef,
 llvm::StringRef, unsigned int, unsigned int, unsigned int) + 201
 9  libLLVM.dylib            0x000000010e01c5ee bool
 llvm::MCAsmParserExtension::HandleDirective<(anonymous
 namespace)::DarwinAsmParser, &((anonymous
 namespace)::DarwinAsmParser::parseSectionDirectiveModInitFunc(llvm::StringRef,
 llvm::SMLoc))>(llvm::MCAsmParserExtension*, llvm::StringRef, llvm::SMLoc)
 + 44
 10 libLLVM.dylib            0x000000010e0054d5 (anonymous
 namespace)::AsmParser::parseStatement((anonymous
 namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) + 2127
 11 libLLVM.dylib            0x000000010e0013b7 (anonymous
 namespace)::AsmParser::Run(bool, bool) + 395
 12 clang                    0x000000010b925fe0
 cc1as_main(llvm::ArrayRef<char const*>, char const*, void*) + 10156
 13 clang                    0x000000010b92127b main + 7864
 14 libdyld.dylib            0x00007fff7f8ec3d5 start + 1
 clang: error: unable to execute command: Abort trap: 6
 clang: error: clang integrated assembler command failed due to signal (use
 -v to see invocation)
 clang version 7.0.1 (tags/RELEASE_701/final)
 Target: x86_64-apple-darwin18.5.0
 Thread model: posix
 InstalledDir: /opt/local/libexec/llvm-7.0/bin
 clang: note: diagnostic msg: PLEASE submit a bug report to
 https://bugs.llvm.org/ and include the crash backtrace, preprocessed
 source, and associated run script.
 clang: note: diagnostic msg: Error generating preprocessed source(s) - no
 preprocessable inputs.
 $
 }}}

 Here's the source of the reproducer:
 {{{
 #include <iostream>

 /* output (compiler_name,language_standard,cpu_type)

    compiler_name:
    Right now, we just recognize "gcc", "clang", and "icc".
    Other compilers are named "unknown".

    language_standard:
    As of 2018, the available language standards are
    199711, 201103, 201402, 201703.

    cpu_type:
    Right now, we just recognize x86 and x86-64, and both are named "x86".
    Other CPUs are named "unknown".

 */

 #ifndef __cplusplus
 #define __cplusplus 1
 #endif


 int main()
 {
    long language_standard = __cplusplus;
    // convert to one of 0, 1997, 2011, 2014, 2017
    if      (language_standard >= 201703) language_standard = 2017;
    else if (language_standard >= 201402) language_standard = 2014;
    else if (language_standard >= 201103) language_standard = 2011;
    else if (language_standard >= 199711) language_standard = 1997;
    else                                  language_standard = 0;

    const char *compiler_name = "unknown";

    const char *cpu_type = "unknown";

 #if defined(__INTEL_COMPILER)
    compiler_name = "icc";
 #elif defined(__clang__)
    compiler_name = "clang";
 #elif defined (__GNUC__)
    compiler_name = "gcc";
 #else
    compiler_name = "";
 #endif

 #if defined(__x86_64__) || defined(__x86_64) || defined(__i386__) ||
 defined(__i386)
    cpu_type = "x86";
 #endif

    std::cout << "(" << compiler_name << "," << language_standard
              << "," << cpu_type << ")\n";

 }
 }}}

 If you find this reproducer too complex - try the following (same setup as
 above):
 {{{
 $ cat t.cpp
 int main() {
    return 0;
 }
 $ g++ -v
 Using built-in specs.
 COLLECT_GCC=g++
 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin18/9.1.0
 /lto-wrapper
 Target: x86_64-apple-darwin18
 Configured with:
 /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc9/gcc9/work/gcc-9.1.0/configure
 --prefix=/opt/local --build=x86_64-apple-darwin18 --enable-
 languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc9
 --includedir=/opt/local/include/gcc9 --infodir=/opt/local/share/info
 --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-9 --with-
 local-prefix=/opt/local --with-system-zlib --disable-nls --program-
 suffix=-mp-9 --with-gxx-include-dir=/opt/local/include/gcc9/c++/ --with-
 gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-
 isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto
 --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-
 as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-
 ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
 --disable-tls --with-pkgversion='MacPorts gcc9 9.1.0_1' --with-
 sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
 Thread model: posix
 gcc version 9.1.0 (MacPorts gcc9 9.1.0_1)
 $ g++ -g -o t t.cpp
 Assertion failed: (!CreatedADWARFSection && "Creating regular section
 after DWARF"), function ChangeSection, file
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-7.0/llvm-7.0/work/llvm-7.0.1.src/lib/MC/MCMachOStreamer.cpp,
 line 159.
 Stack dump:
 0.      Program arguments: /opt/local/libexec/llvm-7.0/bin/clang -cc1as
 -triple x86_64-apple-macosx10.14.0 -filetype obj -main-file-name
 ccPuEY3t.s -target-cpu penryn -fdebug-compilation-dir
 /Users/ur20980/src/ntl-11.3.2/src -dwarf-debug-producer clang version
 7.0.1 (tags/RELEASE_701/final) -dwarf-version=4 -mrelocation-model pic -o
 /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T//ccOxbizy.o
 /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T//ccPuEY3t.s
 0  libLLVM.dylib            0x00000001151ae8b0
 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
 1  libLLVM.dylib            0x00000001151aeca1 SignalHandler(int) + 200
 2  libsystem_platform.dylib 0x00007fff7fad1b5d _sigtramp + 29
 3  libsystem_platform.dylib 0x0000000000003be0 _sigtramp + 2152931488
 4  libsystem_c.dylib        0x00007fff7f9916a6 abort + 127
 5  libsystem_c.dylib        0x00007fff7f95a20d basename_r + 0
 6  libLLVM.dylib            0x0000000115d8e479 (anonymous
 namespace)::MCMachOStreamer::ChangeSection(llvm::MCSection*, llvm::MCExpr
 const*) + 793
 7  libLLVM.dylib            0x0000000115d9bb89
 llvm::MCStreamer::SwitchSection(llvm::MCSection*, llvm::MCExpr const*) +
 97
 8  libLLVM.dylib            0x0000000115dd2dab (anonymous
 namespace)::DarwinAsmParser::parseSectionSwitch(llvm::StringRef,
 llvm::StringRef, unsigned int, unsigned int, unsigned int) + 201
 9  libLLVM.dylib            0x0000000115dd2ebe bool
 llvm::MCAsmParserExtension::HandleDirective<(anonymous
 namespace)::DarwinAsmParser, &((anonymous
 namespace)::DarwinAsmParser::parseSectionDirectiveConstructor(llvm::StringRef,
 llvm::SMLoc))>(llvm::MCAsmParserExtension*, llvm::StringRef, llvm::SMLoc)
 + 44
 10 libLLVM.dylib            0x0000000115dbc4d5 (anonymous
 namespace)::AsmParser::parseStatement((anonymous
 namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) + 2127
 11 libLLVM.dylib            0x0000000115db83b7 (anonymous
 namespace)::AsmParser::Run(bool, bool) + 395
 12 clang                    0x000000010ffccfe0
 cc1as_main(llvm::ArrayRef<char const*>, char const*, void*) + 10156
 13 clang                    0x000000010ffc827b main + 7864
 14 libdyld.dylib            0x00007fff7f8ec3d5 start + 1
 clang: error: unable to execute command: Abort trap: 6
 clang: error: clang integrated assembler command failed due to signal (use
 -v to see invocation)
 clang version 7.0.1 (tags/RELEASE_701/final)
 Target: x86_64-apple-darwin18.5.0
 Thread model: posix
 InstalledDir: /opt/local/libexec/llvm-7.0/bin
 clang: note: diagnostic msg: PLEASE submit a bug report to
 https://bugs.llvm.org/ and include the crash backtrace, preprocessed
 source, and associated run script.
 clang: note: diagnostic msg: Error generating preprocessed source(s) - no
 preprocessable inputs.
 $ g++ -o t t.cpp
 $ ./t
 $
 }}}

 In short, {{{-g}}} seems to be the trigger. And no matter what you set
 LLVM to, it will use Macports LLVM-7.0 because Macports GCC9 depends on
 Macports Clang-7.0 that uses Macports LLVM-7.0.

-- 
Ticket URL: <https://trac.macports.org/ticket/58442#comment:50>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list