Operating System Info
Other
Other OS
all OS
OBS Studio Version
Git
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://eel.is/c++draft/defns.undefined
OBS Studio Crash Log URL
No response
Expected Behavior
defined behavior
Current Behavior
[defns.undefined]
3.65 [defns.undefined] undefined behavior
behavior for which this document imposes no requirements
[Note 1: Undefined behavior may be expected when this document omits any explicit definition of behavior or when a program uses an incorrect construct or invalid data. Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message ([defns.diagnostic])), to terminating a translation or execution (with the issuance of a diagnostic message). Many incorrect program constructs do not engender undefined behavior; they are required to be diagnosed. Evaluation of a constant expression ([expr.const]) never exhibits behavior explicitly specified as undefined in [intro] through [cpp]. — end note]
these lines cause undefined behavior:
|
out = util_add128(out, util_lshift64_internal_32(m)); |
|
out = util_add128(out, util_lshift64_internal_64(m)); |
here output is union with uint32_t i32[4]; active member,
|
out.i32[3] = (uint32_t)val; |
but read as
struct {
uint64_t low;
uint64_t high;
};
here:
|
val = (a.low & 0xFFFFFFFFULL) + (b.low & 0xFFFFFFFFULL); |
uint32_t i32[4]; and struct { uint64_t low; uint64_t high; }; are not same standard-layout!
https://eel.is/c++draft/basic.life#2.sentence-3
https://eel.is/c++draft/class.union#general-2
https://eel.is/c++draft/basic.life#8
https://en.cppreference.com/w/cpp/language/union
other links:
https://gitlab.com/libeigen/eigen/-/issues/2898
arduino/ArduinoCore-API#225
Steps to Reproduce
compile and using
Anything else we should know?
No response
Operating System Info
Other
Other OS
all OS
OBS Studio Version
Git
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://eel.is/c++draft/defns.undefined
OBS Studio Crash Log URL
No response
Expected Behavior
defined behavior
Current Behavior
[defns.undefined]
these lines cause undefined behavior:
obs-studio/libobs/util/util_uint128.h
Line 83 in 8e129b1
obs-studio/libobs/util/util_uint128.h
Line 86 in 8e129b1
here output is union with
uint32_t i32[4];active member,obs-studio/libobs/util/util_uint128.h
Line 49 in 8e129b1
but read as
here:
obs-studio/libobs/util/util_uint128.h
Line 36 in 8e129b1
uint32_t i32[4];andstruct { uint64_t low; uint64_t high; };are not same standard-layout!https://eel.is/c++draft/basic.life#2.sentence-3
https://eel.is/c++draft/class.union#general-2
https://eel.is/c++draft/basic.life#8
https://en.cppreference.com/w/cpp/language/union
other links:
https://gitlab.com/libeigen/eigen/-/issues/2898
arduino/ArduinoCore-API#225
Steps to Reproduce
compile and using
Anything else we should know?
No response