[Bug 40350] New: MinGW binary crashes, but msvc6's one works fine in function when returning aggregate value

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Mar 24 11:46:46 CDT 2016


https://bugs.winehq.org/show_bug.cgi?id=40350

            Bug ID: 40350
           Summary: MinGW binary crashes, but msvc6's one works fine in
                    function when returning aggregate value
           Product: Wine
           Version: unspecified
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: -unknown
          Assignee: wine-bugs at winehq.org
          Reporter: mittorn at sibmail.com
      Distribution: ---

This is very strange bug.
Application (https://github.com/SDLash3D/xash3d) contains function that returns
aggregate value.
It may be built with MinGW or MSVC.
Function is called from msvc code. It works fine in windows with both msvc and
MinGW libraries (that is very strange as gcc has different way of returning
aggregates), but it does not work in wine (causes stack corruption).

Structure and function code

struct pmtrace_s
{
    qboolean    allsolid;        // if true, plane is not valid
    qboolean    startsolid;    // if true, the initial point was in a solid
area
    qboolean    inopen, inwater;  // End point is in empty space or in water
    float    fraction;        // time completed, 1.0 = didn't hit anything
    vec3_t    endpos;        // final position
    pmplane_t    plane;        // surface normal at impact
    int    ent;        // entity at impact
    vec3_t    deltavelocity;    // Change in player's velocity caused by
impact.  
                // Only run on server.
    int    hitgroup;
};

static pmtrace_t pfnPlayerTrace(float *start, float *end, int traceFlags, int
ignore_pe)
{
    return PM_PlayerTraceExt( svgame.pmove, start, end, traceFlags,
svgame.pmove->numphysent, svgame.pmove->physents, ignore_pe, NULL );
}

Also, application has DLL loader for linux (based on mplayer code)

It has some workaround for this function.
When dll loader used, application export this repacement to API:
#ifdef DLL_LOADER
static pmtrace_t *pfnPlayerTrace_w32(pmtrace_t *trace, float *start, float
*end, int traceFlags, int ignore_pe)
{
    *trace = PM_PlayerTraceExt( svgame.pmove, start, end, traceFlags,
svgame.pmove->numphysent, svgame.pmove->physents, ignore_pe, NULL );
    return trace;
}
#endif
It works correctly when called from msvc code on linux.
File with function, causing problems:
https://github.com/SDLash3D/xash3d/blob/master/engine/server/sv_pmove.c
MSVC binaries:
https://transfer.sh/8wRoD/xash3d-win.7z
MinGW binary:
https://transfer.sh/par30/xash3d-mingw-16-03-21-12-57.7z
Linux binary:
https://transfer.sh/pmKos/xash3d-linux-16-03-21-12-57.7z
The main question: Why it works correctly in windows and how to workaround this
in wine?

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list