Bug 261567 - science/chrono: clang-12 crashes when option OPENGL=ON
Summary: science/chrono: clang-12 crashes when option OPENGL=ON
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL: https://reviews.llvm.org/D107385
Keywords: crash
Depends on:
Blocks:
 
Reported: 2022-01-30 06:04 UTC by Yuri Victorovich
Modified: 2024-01-02 03:21 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable13+
koobs: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2022-01-30 06:04:44 UTC
To reproduce:
1. Comment out the OPENGL_BROKEN= line
2. Choose OPENGL=ON


Build breaks:
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/c++ -DBP_USE_FIXEDPOINT_INT_32 -DCH_API_COMPILE_OPENGL -DCH_IGNORE_DEPRECATED -DChronoEngine_opengl_EXPORTS -DGLM_ENABLE_EXPERIMENTAL -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src -I/disk-samsung/freebsd-ports/science/chrono/work/.build -I/usr/local/include/eigen3 -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono/collision/bullet -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono/collision/gimpact -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono/../chrono_thirdparty/HACD -I/disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono/../chrono_thirdparty/HACDv2 -I/usr/local/include -I/usr/local/include/GLFW -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -pthread -fopenmp=libomp -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -pthread -fopenmp=libomp -msse4.2 -mavx2 -mfma -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -msse4.2 -mavx2 -mfma -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -pthread -fopenmp=libomp -msse4.2 -mavx2 -mfma -DNDEBUG -fPIC -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -pthread -fopenmp=libomp -msse4.2 -mavx2 -mfma -Wno-unknown-warning-option -Wno-reorder-ctor -Wno-pragma-pack -Wno-unused-local-typedef -Wno-unused-function -Wno-unused-parameter -MD -MT src/chrono_opengl/CMakeFiles/ChronoEngine_opengl.dir/ChOpenGLViewer.cpp.o -MF CMakeFiles/ChronoEngine_opengl.dir/ChOpenGLViewer.cpp.o.d -o CMakeFiles/ChronoEngine_opengl.dir/ChOpenGLViewer.cpp.o -c /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp
1.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:251:9: current parser token '}'
2.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:61:1: parsing namespace 'chrono'
3.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:62:1: parsing namespace 'chrono::opengl'
4.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:180:46: parsing function body 'chrono::opengl::ChOpenGLViewer::Render'
5.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:180:46: in compound statement ('{}')
6.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:186:29: in compound statement ('{}')
7.      /disk-samsung/freebsd-ports/science/chrono/work/chrono-7.0.1/src/chrono_opengl/ChOpenGLViewer.cpp:243:16: in compound statement ('{}')
#0 0x000000000404ec91 PrintStackTrace /disk-samsung/freebsd-src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
#1 0x000000000404d035 RunSignalHandlers /disk-samsung/freebsd-src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:72:18
#2 0x0000000003fecfa3 HandleCrash /disk-samsung/freebsd-src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
#3 0x0000000003fecfa3 CrashRecoverySignalHandler /disk-samsung/freebsd-src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:388:51
#4 0x0000000805335e60 handle_signal /disk-samsung/freebsd-src/lib/libthr/thread/thr_sig.c:0:3
c++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
FreeBSD clang version 12.0.1 (git@github.com:llvm/llvm-project.git llvmorg-12.0.1-0-gfed41342a82f)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: Error generating preprocessed source(s).
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2022-01-30 06:06:38 UTC
Usually clang leaves reproducer files under /tmp when it crashes, but in this case no such files were left.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2022-01-30 14:53:47 UTC
(In reply to Yuri Victorovich from comment #1)
For me it doesn't go beyond the configure step, it ends with:

...
-- Found OpenGL: /usr/local/lib/libOpenGL.so
-- Could NOT find GLM (missing: GLM_INCLUDE_DIR)
Cannot build ChronoEngine_OpenGL (missing dependencies).
-- ==== Chrono models ====
-- Robot models...
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLEW_INCLUDE_DIR
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
GLEW_LIBRARY
    linked by target "ChronoEngine_opengl" in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
GLFW_INCLUDE_DIR
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
   used as include directory in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl
GLFW_LIBRARY
    linked by target "ChronoEngine_opengl" in directory /wrkdirs/share/dim/ports/science/chrono/work/chrono-6.0.0/src/chrono_opengl

CMake Error in src/chrono_opengl/CMakeLists.txt:
  Found relative path while evaluating include directories of "embedfile":

    "GLEW_INCLUDE_DIR-NOTFOUND"



CMake Error in src/chrono_opengl/CMakeLists.txt:
  Found relative path while evaluating include directories of
  "ChronoEngine_opengl":

    "GLEW_INCLUDE_DIR-NOTFOUND"



-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_C_FLAGS_RELEASE
    CMAKE_MODULE_LINKER_FLAGS


CMake Generate step failed.  Build files cannot be regenerated correctly.

Not sure where it wants to get the GLEW lib from, but it apparently isnt' listed in the build-depends-list.
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2022-01-30 17:56:56 UTC
Indeed dependencies were missing.

It looks like missing dependencies alone causes clang to crash in this case.

Closing for now since it doesn't crash in the course of normal build.

This is still a bug in clang though.


Thank you for your help, Dimitry.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-01-30 20:42:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fdf27841010464ad65c8791077a07000cdb01013

commit fdf27841010464ad65c8791077a07000cdb01013
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-01-30 20:41:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-01-30 20:41:37 +0000

    Apply clang fix for assertion failure compiling science/chrono

    Merge commit 6b0f35931a44 from llvm git (by Jennifer Yu):

      Fix signal during the call to checkOpenMPLoop.

      The root problem is a null pointer is accessed during the call to
      checkOpenMPLoop, because loop up bound expr is an error expression
      due to error diagnostic was emit early.

      To fix this, in setLCDeclAndLB, setUB and setStep instead return false,
      return true when LB, UB or Step contains Error, so that the checking is
      stopped in checkOpenMPLoop.

      Differential Revision: https://reviews.llvm.org/D107385

    Note this only fixes the assertion reported in bug 261567; some other
    tweaks for port dependencies are probably still required to make it
    build to completion.

    PR:             261567
    MFC after:      3 days

 contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-02-02 20:53:33 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=40b816bd4f0861ca4df717f255347a21e77d4379

commit 40b816bd4f0861ca4df717f255347a21e77d4379
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-01-30 20:41:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-02-02 20:51:40 +0000

    Apply clang fix for assertion failure compiling science/chrono

    Merge commit 6b0f35931a44 from llvm git (by Jennifer Yu):

      Fix signal during the call to checkOpenMPLoop.

      The root problem is a null pointer is accessed during the call to
      checkOpenMPLoop, because loop up bound expr is an error expression
      due to error diagnostic was emit early.

      To fix this, in setLCDeclAndLB, setUB and setStep instead return false,
      return true when LB, UB or Step contains Error, so that the checking is
      stopped in checkOpenMPLoop.

      Differential Revision: https://reviews.llvm.org/D107385

    Note this only fixes the assertion reported in bug 261567; some other
    tweaks for port dependencies are probably still required to make it
    build to completion.

    PR:             261567
    MFC after:      3 days

    (cherry picked from commit fdf27841010464ad65c8791077a07000cdb01013)

 contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-02-02 20:57:35 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e50055f1ad21b5183b357877b68c51e1ee835fc

commit 6e50055f1ad21b5183b357877b68c51e1ee835fc
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-01-30 20:41:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-02-02 20:52:33 +0000

    Apply clang fix for assertion failure compiling science/chrono

    Merge commit 6b0f35931a44 from llvm git (by Jennifer Yu):

      Fix signal during the call to checkOpenMPLoop.

      The root problem is a null pointer is accessed during the call to
      checkOpenMPLoop, because loop up bound expr is an error expression
      due to error diagnostic was emit early.

      To fix this, in setLCDeclAndLB, setUB and setStep instead return false,
      return true when LB, UB or Step contains Error, so that the checking is
      stopped in checkOpenMPLoop.

      Differential Revision: https://reviews.llvm.org/D107385

    Note this only fixes the assertion reported in bug 261567; some other
    tweaks for port dependencies are probably still required to make it
    build to completion.

    PR:             261567
    MFC after:      3 days

    (cherry picked from commit fdf27841010464ad65c8791077a07000cdb01013)

 contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-07 07:37:48 UTC
^Triage: Assign to committer resolving and track merges so far.

@Dim Feel free to close if there's nothing remaining to resolve or commits/merges to land
Comment 8 Mark Linimon freebsd_committer freebsd_triage 2024-01-02 03:21:49 UTC
^Triage: the 12 branch is now out of support.

In any case, this appears to have been fixed in 2022.