You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Development Machine, OS, Compiler (and Other Relevant Toolchain Info)
OS: QNX8
Raspberry Pi 4, gcc 12.1.0
QEMU x64, gcc 12.1.0
SDK Version (Please Give Commit SHA if Manually Compiling)
LTS_08_2023
Describe the Bug
This issue occurs at several places in the unit tests, but let's look at prov_sc_delete_device_registration_state_GOLDEN_NO_ETAG in provisioning_service_client/tests/provisioning_service_client_ut/provisioning_service_client_ut.c as an example.
This test expects deviceRegistrationState_getEtag, deviceRegistrationState_getRegistrationId to be called in this order:
Order of evaluation of the operands of any C operator, including the order of evaluation of function arguments in a function-call expression, and the order of evaluation of the subexpressions within any expression is unspecified (except where noted below). The compiler will evaluate them in any order, and may choose another order when the same expression is evaluated again.
Here you are making the assumption that deviceRegistrationState_getEtag will be called before deviceRegistrationState_getRegistrationId. In practice, this works for gcc-x86_64. However, gcc-arm64 calls deviceRegistrationState_getRegistrationId before deviceRegistrationState_getEtag.
As a result, this test (along with several other tests) would fail on my raspberry pi.
The text was updated successfully, but these errors were encountered:
Development Machine, OS, Compiler (and Other Relevant Toolchain Info)
OS: QNX8
Raspberry Pi 4, gcc 12.1.0
QEMU x64, gcc 12.1.0
SDK Version (Please Give Commit SHA if Manually Compiling)
LTS_08_2023
Describe the Bug
This issue occurs at several places in the unit tests, but let's look at
prov_sc_delete_device_registration_state_GOLDEN_NO_ETAG
inprovisioning_service_client/tests/provisioning_service_client_ut/provisioning_service_client_ut.c
as an example.This test expects deviceRegistrationState_getEtag, deviceRegistrationState_getRegistrationId to be called in this order:
And this is the actual call site in prov_sc_delete_device_registration_state:
Notice that both mocks, deviceRegistrationState_getEtag and deviceRegistrationState_getRegistrationId, are arguments to a function.
This is what cppreference says about the order of evaluation of arguments (https://en.cppreference.com/w/c/language/eval_order):
Here you are making the assumption that deviceRegistrationState_getEtag will be called before deviceRegistrationState_getRegistrationId. In practice, this works for gcc-x86_64. However, gcc-arm64 calls deviceRegistrationState_getRegistrationId before deviceRegistrationState_getEtag.
As a result, this test (along with several other tests) would fail on my raspberry pi.
The text was updated successfully, but these errors were encountered: