-
Notifications
You must be signed in to change notification settings - Fork 650
Hexen: Do not read player field from struct degenmobj_t
#1757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
turol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments would be nice to explain why we are checking this.
Isn't the check in S_StartSoundAtVolume the wrong way? When called from problematic EV_RotatePoly it's likely that the bogus check for origin>player evaluates to true so the line should be
if (origin->thinker.function == P_DegenMobjThinker || origin->player)
|
I remembered that identical code folding optimization can lead to a situation where two functions have the same address and the comparison breaks. This code might be fragile. |
Yes, you are right, thank you! I even said this myself here: #1756 (comment) I have inverted the logic and added a comment. |
Eh, could you elaborate, please? What you describe here sounds more like a compiler bug to me. |
It's a space optimization by the compiler and/or linker. GNU gold at least implements it and MSVC has some version of it as "identical COMDAT folding". Most of the time it doesn't matter if functions have identical addresses or not and it can save significant amounts of space. At least gold is supposed to have a safe mode which will avoid merging functions which have their addresses taken but it might require support from the compiler. It has also been known to break things in the past but those are classified as bugs. To be safe you could add something unique to |
|
I see, that's a valid point, thank you. I didn't even know this could cause an issue. |
Fixes #1756