[LLVMbugs] [Bug 23421] New: ICE when using __underlying_type builtin trait in template alias

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 5 11:37:10 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23421

            Bug ID: 23421
           Summary: ICE when using __underlying_type builtin trait in
                    template alias
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: daniel at octaforge.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14285
  --> https://llvm.org/bugs/attachment.cgi?id=14285&action=edit
the generated source from clang to reproduce the ICE

Found a bug while trying stuff today. Using the __underlying_type trait in the
context of template alias triggers an ICE; wrapping it in a struct first and
then using that works fine. This happens on FreeBSD 11, with Clang 3.4 and
3.7-trunk.

The testcase:

-----
#include <stdio.h>
#include <type_traits>

/* this does not work */
template<typename T> using Foo = __underlying_type(T);

/* this works */
template<typename T> struct Test {
    typedef __underlying_type(T) type;
};

template<typename T> using Bar = typename Test<T>::type;

/* testcase */
enum class Baz: short { FOO };

int main() {
    printf("%d\n", std::is_same<short, Foo<Baz>>::value);
    printf("%d\n", std::is_same<short, Bar<Baz>>::value);
    return 0;
}
-----

"Foo" is the broken version. "Bar" is an equivalent working version. The error
message:

-----
q66 at butts: /home/q66/octastd$ clang++-devel ice.cpp -o ice -std=c++11 -Wall
-Wextra
clang: error: unable to execute command: Bus error (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (trunk)
Target: x86_64-portbld-freebsd11.0
Thread model: posix
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/ice-b463b2.cpp
clang: note: diagnostic msg: /tmp/ice-b463b2.sh
clang: note: diagnostic msg: 

********************
-----

Here is the generated run script:

-----
# Crash reproducer for clang version 3.7.0 (trunk)
# Original command:  "/usr/local/llvm-devel/bin/clang" "-cc1" "-triple"
"x86_64-portbld-freebsd11.0" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "ice.cpp" "-mrelocation-model"
"static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-target-linker-version" "2.17.50" "-dwarf-column-info"
"-fno-unique-section-names" "-resource-dir"
"/usr/local/llvm-devel/bin/../lib/clang/3.7.0" "-internal-isystem"
"/usr/include/c++/v1" "-Wall" "-Wextra" "-std=c++11" "-fdeprecated-macro"
"-fdebug-compilation-dir" "/home/q66/octastd" "-ferror-limit" "19"
"-fmessage-length" "215" "-mstackrealign" "-fobjc-runtime=gnustep"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-o" "/tmp/ice-e9d9e7.o" "-x" "c++" "ice.cpp"
 "/usr/local/llvm-devel/bin/clang" "-cc1" "-triple"
"x86_64-portbld-freebsd11.0" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "ice.cpp" "-mrelocation-model"
"static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-target-linker-version" "2.17.50" "-dwarf-column-info"
"-fno-unique-section-names" "-Wall" "-Wextra" "-std=c++11" "-fdeprecated-macro"
"-ferror-limit" "19" "-fmessage-length" "215" "-mstackrealign"
"-fobjc-runtime=gnustep" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c++" "ice-b463b2.cpp"
-----

I attached the generated source.

If you need any more info, let me know.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150505/62ab8f36/attachment.html>


More information about the llvm-bugs mailing list