[llvm-bugs] [Bug 43392] New: clang-cl -fmodules ICE

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 20 17:26:02 PDT 2019


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

            Bug ID: 43392
           Summary: clang-cl -fmodules ICE
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: trass3r at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I tested LLVM_ENABLE_MODULES with clang-cl on trunk by using the following
patch:

diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake
b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 5e57a3b82..4cafd73fc 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -463,9 +463,9 @@ if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR
CMAKE_CXX_COMPILER_ID MATCHES "XL" )
 endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )

 # Modules enablement for GCC-compatible compilers:
-if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
+if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND LLVM_ENABLE_MODULES )
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(module_flags "-fmodules
-fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache")
+  set(module_flags "-Xclang -fmodules -Xclang -fimplicit-module-maps -Xclang
-fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache")
   if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
     # On Darwin -fmodules does not imply -fcxx-modules.
     set(module_flags "${module_flags} -fcxx-modules")


But it crashes soon:

C:\PROGRA~1\LLVM\bin\clang-cl.exe  /nologo -TP -DGTEST_HAS_RTTI=0 -DUNICODE
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Ilib\Support -I..\llvm\lib\Support -Iinclude -I..\llvm\include /DWIN32
/D_WINDOWS /D_HAS_EXCEPTIONS=0   /GS- /Z7 -Xclang -ftime-trace -gcodeview-ghash
/Zc:dllexportInlines- /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast -Xclang
-fmodules -Xclang -fimplicit-module-maps -Xclang
-fmodules-cache-path=C:/Code/llvm-mctoll/objdir/module.cache -Xclang
-fmodules-local-submodule-visibility /W4  -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wdelete-non-virtual-dtor
-Wstring-conversion /MT /O2 /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes
/Folib\Support\CMakeFiles\LLVMSupport.dir\ARMTargetParser.cpp.obj
/Fdlib\Support\CMakeFiles\LLVMSupport.dir\LLVMSupport.pdb -c
..\llvm\lib\Support\ARMTargetParser.cpp
While building module 'LLVM_Utils' imported from
..\llvm\lib\Support\ARMTargetParser.cpp:14:
While building module 'LLVM_C' imported from
..\llvm\include\llvm/Support/DataTypes.h:16:
In file included from <module-includes>:17:
..\llvm\include\llvm-c/.\lto.h(238,54): error: declaration of 'off_t' must be
imported from module 'LLVM_C.DataTypes' before it is required
                                    size_t map_size, off_t offset);
                                                     ^
C:\Program Files (x86)\Windows
Kits\10\include\10.0.18362.0\ucrt\sys/types.h(42,24): note: previous
declaration is here
        typedef _off_t off_t;
                       ^
While building module 'LLVM_Utils' imported from
..\llvm\lib\Support\ARMTargetParser.cpp:14:
In file included from <module-includes>:1:
In file included from ..\llvm\include\llvm/ADT\AllocatorList.h:12:
In file included from ..\llvm\include\llvm/ADT/ilist_node.h:17:
In file included from ..\llvm\include\llvm/ADT/ilist_node_base.h:12:
In file included from ..\llvm\include\llvm/ADT/PointerIntPair.h:16:
In file included from ..\llvm\include\llvm/Support/PointerLikeTypeTraits.h:17:
..\llvm\include\llvm/Support/DataTypes.h(16,10): fatal error: could not build
module 'LLVM_C'
#include "llvm-c/DataTypes.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Stack dump:
0.      ..\llvm\include\llvm/Support/MachineValueType.h:262:6: current parser
token ';'
1.      ..\llvm\include\llvm/Support/MachineValueType.h:23:1: parsing namespace
'llvm'
2.      ..\llvm\include\llvm/Support/MachineValueType.h:30:3: parsing
struct/union/class body 'llvm::MVT'
 #0 0x00007ff6b4dbd060 (C:\PROGRA~1\LLVM\bin\clang-cl.exe+0x2c2d060)
...
#25 0x00007ff6b3827eed (C:\PROGRA~1\LLVM\bin\clang-cl.exe+0x1697eed)
#26 0x00007ffcc11fd9f2 (C:\WINDOWS\System32\ucrtbase.dll+0x1d9f2)
#27 0x00007ffcc1ba7bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
#28 0x00007ffcc37ecee1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6cee1)
clang-cl: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-pc-windows-msvc

-- 
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/20190921/6ecf2f77/attachment.html>


More information about the llvm-bugs mailing list