Opened 16 years ago

Closed 16 years ago

Last modified 5 years ago

#3975 closed defect (fixed)

IRIX: Crash when starting ANY game from launcher

Reported by: joostp Owned by: cyxx
Priority: normal Component: Port: IRIX
Version: Keywords:
Cc: Game:

Description

With latest SVN (r34611) on an SGI Octane with IRIX 6.5.27 (64-bit, big endian, requires alignment), attempting to start any game from the launcher gives a segfault.

The cause of this seems to happen when a "large" String (exceeding the default capacity - in this case the path of the game) gets pushed in via addDefaultDirectoryRecursive.

The String class will then allocate memory on the heap, but it appears this memory isn't properly aligned. (just a guess, I haven't checked the values, I can do that shortly).

backtrace:

Starting program: /usr/people/joostp/src/svn/scummvm/scummvm -p /usr/people/joostp/games/bass/ sky User picked target 'sky' (gameid 'sky')... Looking for a plugin supporting this gameid... Beneath a Steel Sky Starting 'Beneath a Steel Sky'

Program received signal SIGSEGV, Segmentation fault. 0x10419048 in Common::String::incRefCount (this=0x7fff23c4) at common/str.cpp:183 183 ++(*_extern._refCount); (gdb) bt #0 0x10419048 in Common::String::incRefCount (this=0x7fff23c4) at common/str.cpp:183 #1 0x10418a8c in String (this=0x105385ac, str=@0x7fff23c4) at common/str.cpp:88 #2 0x10435134 in Node (this=0x105385a8, _ctor_arg=@0x7fff23c0) at common/archive.cpp:270 #3 0x10437e50 in Node (this=0x105385a0, x=@0x7fff23c0) at list.h:52 #4 0x10436dd4 in Common::List<Common::SearchSet::Node>::insert ( this=0x1053764c, pos={_node = 0x1053764c}, element=@0x7fff23c0) at list.h:158 #5 0x10434b18 in Common::SearchSet::insert (this=0x10537648, node=@0x7fff23c0) at common/archive.cpp:231 #6 0x10434c64 in Common::SearchSet::add (this=0x10537648, name=@0x7fff2490, archive= {_refCount = 0x10537880, _deletion = 0x10537890, _pointer = 0x10538018}, priority=1) at common/archive.cpp:237 #7 0x104113c0 in Common::File::addDefaultDirectoryRecursive ( dir=@0x7fff2510, level=4) at common/file.cpp:61 #8 0x10411164 in Common::File::addDefaultDirectoryRecursive ( directory=@0x7fff2550, level=4) at common/file.cpp:44 #9 0x100b9af8 in runGame (plugin=0x10537678, system=@0x1052f948, edebuglevels=@0x7fff2a20) at base/main.cpp:172

Ticket imported from: #2120595. Ticket imported from: bugs/3975.

Attachments (1)

gcc34_datastruct_copy.diff (920 bytes ) - added by cyxx 16 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by joostp, 16 years ago

Apparently, the same problem occurs on win32 too, see: http://sourceforge.net/tracker/index.php?func=detail&aid=2106292&group_id=37116&atid=418820

So perhaps it's not an alignment issue, but a gcc <= 3.4.2 one (I'm using 3.4.0).

comment:2 by fingolfin, 16 years ago

This is just weird. No idea what might be causing it right now :/.

comment:3 by cyxx, 16 years ago

Just had the same problem with the latest SVN. Apparently gcc 3.4.x generates wrong code for non-pod data structure copy (it seems to create a temporary structure and then memcpy it ; which just messes the String object since _storage points then to a non-existent object).

Adding explicit constructor workarounds the issue...

File Added: gcc34_datastruct_copy.diff

by cyxx, 16 years ago

Attachment: gcc34_datastruct_copy.diff added

comment:4 by cyxx, 16 years ago

File Added: gcc34_datastruct_copy.diff

comment:5 by fingolfin, 16 years ago

Makes sense. Please commit!

comment:6 by cyxx, 16 years ago

Committed as revision #34686.

comment:7 by cyxx, 16 years ago

Owner: changed from fingolfin to cyxx
Resolution: fixed
Status: newclosed

comment:8 by digitall, 5 years ago

Component: --Unset--Port: IRIX
Note: See TracTickets for help on using tickets.