[Scummvm-tracker] [ScummVM :: Bugs] #16397: HPL1: Penumbra crashes on a new game
ScummVM :: Bugs
trac at scummvm.org
Tue Dec 16 15:21:17 UTC 2025
#16397: HPL1: Penumbra crashes on a new game
-------------------------------+--------------------------
Reporter: shamazmazum | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Engine: HPL1
Version: | Keywords:
Game: Penumbra: Overture |
-------------------------------+--------------------------
Due to violation of strict aliasing rule, Penumbra: Overture crashes if
scummvm is build with -O2 (maybe also -O) with clang 19
My environment:
* FreeBSD 15.0
* clang 19.1.7 (default version in FreeBSD)
How I build
{{{
$ setenv CXXFLAGS "-O2 -g -fno-strict-aliasing"
$ ./configure --disable-alsa --disable-nasm --disable-seq-midi --disable-
tremor --disable-fluidlite --prefix=/home/vasily/test/scummvm3
$ gmake -j8
$ gmake install
}}}
Then I start the game, skip a cutscene and the game crashes:
{{{
(lldb) target create bin/scummvm --core scummvm.core
[8578/16640] Manually indexing DWARF: scummvm...
Core file '/home/vasily/test/scummvm3/scummvm.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'scummvm', stop reason = signal SIGBUS
* frame #0: 0x00000000035e9848
scummvm`NewtonCreateBody(newtonWorld=0x000004705eae4880,
collisionPtr=0x000004705eacf300, matrixPtr=0x00000000011362a8) at
Newton.cpp:4489:11
frame #1: 0x00000000035307c3
scummvm`hpl::cPhysicsBodyNewton::cPhysicsBodyNewton(this=0x000004705dfec300,
asName=<unavailable>, apWorld=0x000004705d431400,
apShape=0x000004705b4a2900) at PhysicsBodyNewton.cpp:58:17
frame #2: 0x000000000352e9c2
scummvm`hpl::cPhysicsWorldNewton::CreateBody(this=0x000004705d431400,
asName=0x000004705b4991a8, apShape=0x000004705b4a2900) at
PhysicsWorldNewton.cpp:322:30
frame #3: 0x00000000034fcd0c
scummvm`hpl::cMeshLoaderCollada::CreateStaticMeshEntity(this=0x000004705d01dbc0,
apNode=0x000004705b499180, apWorld=0x000004705b4a1200,
apGeom=0x000004705eea3300, abInRoomGroup=true,
avColladaMaterials=<unavailable>, avColladaTextures=0x0000000826b14c50,
avColladaImages=0x0000000826b14c40) at MeshLoaderCollada.cpp:1417:53
frame #4: 0x00000000034f5c4d
scummvm`hpl::cMeshLoaderCollada::AddSectorChildren(this=0x000004705d01dbc0,
apNode=0x000004705b499180, asSector=<unavailable>,
apWorld=0x000004705b4a1200, avColladaGeometries=0x0000000826b14c70,
avColladaLights=0x0000000826b14c80, avColladaMaterials=0x0000000826b14c60,
avColladaTextures=0x0000000826b14c50, avColladaImages=0x0000000826b14c40)
at MeshLoaderCollada.cpp:2177:29
frame #5: 0x00000000034f5631
scummvm`hpl::cMeshLoaderCollada::LoadWorld(this=0x000004705d01dbc0,
asFile=<unavailable>, apScene=<unavailable>, aFlags=<unavailable>) at
MeshLoaderCollada.cpp:171:6
frame #6: 0x0000000003491b9a
scummvm`hpl::cMeshLoaderHandler::LoadWorld(this=0x000004705d010e90,
asFile=0x0000000826b14ea0, aFlags=0) at MeshLoaderHandler.cpp:115:20
frame #7: 0x00000000034d6872
scummvm`hpl::cScene::LoadWorld3D(this=0x000004705cf5b500,
asFile=0x000004705ca13110, abLoadScript=true, aFlags=0) at
Scene.cpp:367:58
frame #8: 0x00000000035b68b7
scummvm`cMapHandler::Load(this=0x000004705ca14800,
asFile=0x000004705ca13110, asStartPos=0x000004705ca13138) at
MapHandler.cpp:416:22
frame #9: 0x0000000003593177
scummvm`cIntroStory::Exit(this=0x000004705d455c00) at
IntroStory.cpp:505:24
frame #10: 0x000000000357cf4c
scummvm`cButtonHandler::Update(this=0x000004705d473870,
afTimeStep=<unavailable>) at ButtonHandler.cpp:301:26
frame #11: 0x00000000034dad34
scummvm`hpl::cUpdater::Update(this=0x000004705b3e96f0,
afTimeStep=<unavailable>) at Updater.cpp:180:10
frame #12: 0x000000000342bbcd
scummvm`hpl::cGame::Run(this=0x00000470582fe300) at Game.cpp:340:15
frame #13: 0x00000000034257fd
scummvm`Hpl1::Hpl1Engine::run(this=0x000004705ca1bc00) at hpl1.cpp:76:13
frame #14: 0x0000000001f49e7e
scummvm`runGame(enginePlugin=0x0000047057acec20,
system=0x0000047057a296f0, game=0x0000000826b167f0,
meDescriptor=0x00000470582bf600) at main.cpp:317:33
frame #15: 0x0000000001f480f0 scummvm`scummvm_main(argc=1,
argv=0x0000000826b178d0) at main.cpp:803:13
frame #16: 0x0000000001f4448e scummvm`main(argc=1,
argv=0x0000000826b178d0) at posix-main.cpp:44:12
frame #17: 0x000000083e94337f libc.so.7`__libc_start1(argc=1,
argv=0x0000000826b178d0, env=0x0000000826b178e0, cleanup=<unavailable>,
mainX=(scummvm`main at posix-main.cpp:30)) at libc_start1.c:180:7
frame #18: 0x0000000001f22534 scummvm`_start at crt1_s.S:80
(lldb) frame select 0
frame #0: 0x00000000035e9848
scummvm`NewtonCreateBody(newtonWorld=0x000004705eae4880,
collisionPtr=0x000004705eacf300, matrixPtr=0x00000000011362a8) at
Newton.cpp:4489:11
4486 SaveCollision(collisionPtr);
4487 #endif
4488
-> 4489 dgMatrix matrix(*((const dgMatrix *)matrixPtr));
4490 #ifdef _DEBUG
4491 // matrix.m_front = matrix.m_front.Scale (dgRsqrt
(matrix.m_front % matrix.m_front));
4492 // matrix.m_right = matrix.m_front * matrix.m_up;
}}}
For some reason clang ignores -fno-strict-aliasing
When porting Amnesia: The Dark Descent I found the same bug which was
solved by writing a helper function:
{{{
static dgMatrix array2matrix(const dFloat *array) {
dgVector row1(array[0], array[1], array[2], array[3]);
dgVector row2(array[4], array[5], array[6], array[7]);
dgVector row3(array[8], array[9], array[10], array[11]);
dgVector row4(array[12], array[13], array[14], array[15]);
dgMatrix mat(row1, row2, row3, row4);
return mat;
}
}}}
and using this function where unsafe casts were used (in addition to -fno-
strict-aliasing)
I can try to make a similar patch for Penumbra unless you have better
ideas.
--
Ticket URL: <https://bugs.scummvm.org/ticket/16397>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list