Skip to content

Fix undefined behavior in PxUnionCast#65

Open
rsfb wants to merge 1 commit into
NVIDIAGameWorks:masterfrom
rsfb:master
Open

Fix undefined behavior in PxUnionCast#65
rsfb wants to merge 1 commit into
NVIDIAGameWorks:masterfrom
rsfb:master

Conversation

@rsfb

@rsfb rsfb commented Mar 28, 2018

Copy link
Copy Markdown

Fixes crash in linux with a new version of clang.

The C++ standard does not define behavior of accessing a different union member from the one that was last written. std::memcpy is a defined way to accomplish the same.

Fixes crash in linux with a new version of clang.

The C++ standard does not define behavior of accessing a different union member from the one that was last written. std::memcpy is a defined way to accomplish the same.
@AlesBorovicka

Copy link
Copy Markdown
Contributor

Hi,
please, can you give us the clang version so we can try to reproduce the crash on our side?
Thanks a lot,
regards Ales

@rsfb

rsfb commented Mar 28, 2018

Copy link
Copy Markdown
Author

Hi Ales,

Thanks for the quick reply! LLVM versions r327616 and r327695 were the ones we tested.

A bit more detail:

In PsUnixSse2InlineAoS.h there's a gMaskXYZ constant which is initialised with the output of PxUnionCast - with these new compiler versions, the mask had all zeros on all 4 components (instead of all 1, all 1, all 1, all 0 as intended).

Cheers,
Ricardo

@rsfb

rsfb commented Apr 24, 2018

Copy link
Copy Markdown
Author

Hi again Ales,

Was this or a similar fix submitted? Currently we have fixed the gMaskXYZ = 0 problem with the change in this PR.

Regards,
Ricardo

@AlesBorovicka

Copy link
Copy Markdown
Contributor

Hi Ricardo,
no, we have not fixed the issue yet. Still not resolved.
Regards,
Ales

@AlesBorovicka

Copy link
Copy Markdown
Contributor

The issue should be resolved in next update. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants