Adam Mizerski changed bug 1183104
What Removed Added
Status RESOLVED REOPENED
CC   adam@mizerski.pl
Resolution WONTFIX ---

Comment # 3 on bug 1183104 from
I'd like to push this a bit. I found that this might be caused by LTO.

There are 2 very similar functions in the code:

void Sys_FreeFileList( char **list )
{
    int i;

    if ( !list ) {
        return;
    }

    for ( i = 0 ; list[i] ; i++ ) {
        Z_Free( list[i] );
    }

    Z_Free( list );
}


void FS_FreeFileList( char **list ) {
    int        i;

    if ( !fs_searchpaths ) {
        Com_Error( ERR_FATAL, "Filesystem call made without initialization\n"
);
    }

    if ( !list ) {
        return;
    }

    for ( i = 0 ; list[i] ; i++ ) {
        Z_Free( list[i] );
    }

    Z_Free( list );
}

Segfault happens, when Sys_FreeFileList is called with null pointer. Gdb shows
that FS_FreeFileList is called instead ('(gdb) disassemble Sys_FreeFileList'
says 'No symbol "Sys_FreeFileList" in current context.', probably because it
was deduplicated by LTO), it skips the 'if ( !list ) {return;}' part and
segfaults on 'list[i]'.

Adding '-fno-lto' to CFLAGS resolves the problem.


You are receiving this mail because: