[llvm-bugs] [Bug 41737] New: Bullet3 sample code crashes when compiled clang-cl -m32 /O2. Does not crash with /O0

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 3 15:03:25 PDT 2019


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

            Bug ID: 41737
           Summary: Bullet3 sample code crashes when compiled clang-cl
                    -m32 /O2.  Does not crash with /O0
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: merlynop at microsoft.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Note: affects -m32.  No repo if change to -m64.

Prereqs:
- Visual Studio 2019 with C++ Desktop Workload
(https://visualstudio.microsoft.com/vs/)
- Git
- Install LLVM 7.0.1 .msi (doesn't compile with Clang 8 or higher).

Open "x86 Native Tools Command Prompt for VS 2019"

git clone https://github.com/merlynoppenheim/bullet3.git -b merlynop-testing

cd ..
md bullet3-build
cd bullet3-build

Set VSSKU=Community
set CXXFLAGS=-m32
set CFLAGS=-m32
Set CMAKEPATH=C:\PROGRAM FILES (X86)\MICROSOFT VISUAL
STUDIO\2019\%VSSKU%\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe
set NINJAPATH=C:\PROGRAM FILES (X86)\MICROSOFT VISUAL
STUDIO\2019\%VSSKU%\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe
Set CLANGPATH=C:/PROGRAM FILES (X86)/Llvm/bin/clang-cl.exe
Set SOURCEPATH=..\bullet3

"%CMAKEPATH%" -G Ninja -DCMAKE_CXX_COMPILER="%CLANGPATH%"
-DCMAKE_C_COMPILER="%CLANGPATH%"  -DCMAKE_BUILD_TYPE="RelWithDebInfo" 
"%SOURCEPATH%" -DCMAKE_MAKE_PROGRAM="%NINJAPATH%"

"%CMAKEPATH%" --build . -- -v

Run: examples\ExampleBrowser\App_ExampleBrowser.exe

Unexpected result: App_ExampleBrowser.exe crashes

Example clang-cl args: -TP /GR- /Gy /GF -m32  /DWIN32  /W3  /EHsc /arch:SSE2
/fp:fast /wd4244 /wd4267 /MT /Zi /O2 /Ob1 /DNDEBUG 

The exception occurs in b3GraphicsInstance constructor, I suspect when calling
b3MakeVector3, an inline method.

>	App_ExampleBrowser.exe!b3GraphicsInstance::b3GraphicsInstance() Line 179	C++
        App_ExampleBrowser.exe!GLInstancingRenderer::registerShape(const float
* vertices, int numvertices, const int * indices, int numIndices, int
primitiveType, int textureId) Line 1100    C++
        App_ExampleBrowser.exe!OpenGLGuiHelper::registerGraphicsShape(const
float * vertices, int numvertices, const int * indices, int numIndices, int
primitiveType, int textureId) Line 337  C++
       
App_ExampleBrowser.exe!OpenGLGuiHelper::createCollisionShapeGraphicsObject(btCollisionShape
* collisionShape) Line 942  C++
       
App_ExampleBrowser.exe!OpenGLGuiHelper::autogenerateGraphicsObjects(btDiscreteDynamicsWorld
* rbWorld) Line 1351        C++
        App_ExampleBrowser.exe!BasicExample::initPhysics() Line 114     C++
        App_ExampleBrowser.exe!selectDemo(int demoIndex) Line 455       C++
        App_ExampleBrowser.exe!OpenGLExampleBrowser::init(int argc, char * *
argv) Line 1115    C++
        App_ExampleBrowser.exe!main(int argc, char * * argv) Line 75    C++
        App_ExampleBrowser.exe!_initterm(void(*)() * first, void(*)() * last)
Line 16   C++

Sorry for the mega-repro!

-- 
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/20190503/382d44b5/attachment-0001.html>


More information about the llvm-bugs mailing list