Skip to content
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

Fix warnings in chained volatile assignments #332

Open
ericpassmore opened this issue Jan 9, 2025 · 0 comments
Open

Fix warnings in chained volatile assignments #332

ericpassmore opened this issue Jan 9, 2025 · 0 comments

Comments

@ericpassmore
Copy link
Contributor

A test contract declares variables as volatile and then uses them in a chained assignments. This isn't supported, and not sure why the contract is constructed this way.

ptr6[0] = ptr6[1] = ((__int128_t(0x7777777777777777) << 64) | 0x7777777777777777);
volatile __int128_t *ptr7 = (__int128_t*)malloc(sizeof(__int128_t) * 2);
ptr7[0] = ptr7[1] = ((__int128_t(0x8888888888888888) << 64) | 0x8888888888888888);
volatile long long *ptr8 = (long long*)malloc(sizeof(long long) * 3);
ptr8[0] = ptr8[1] = ptr8[2] = 0x9999999999999999;
volatile long long *ptr9 = (long long*)malloc(sizeof(long long) * 3);
ptr9[0] = ptr9[1] = ptr9[2] = 0xAAAAAAAAAAAAAAAA;
eosio::check(*ptr0 == 0x11, "wrong value for char");
eosio::check(*ptr1 == 0x2222, "wrong value for short");
eosio::check(*ptr2 == 0x33333333, "wrong value for int");
eosio::check(*ptr3 == 0x4444444444444444, "wrong value for long long");
eosio::check(*ptr4 == ((__int128_t(0x5555555555555555) << 64) | 0x5555555555555555), "wrong value for __int128 #1");
eosio::check(*ptr5 == ((__int128_t(0x6666666666666666) << 64) | 0x6666666666666666), "wrong value for __int128 #2");
eosio::check(ptr6[0] == ((__int128_t(0x7777777777777777) << 64) | 0x7777777777777777), "wrong value for __int128[2] #1");
eosio::check(ptr6[1] == ((__int128_t(0x7777777777777777) << 64) | 0x7777777777777777), "wrong value for __int128[2] #1");
eosio::check(ptr7[0] == ((__int128_t(0x8888888888888888) << 64) | 0x8888888888888888), "wrong value for __int128[2] #2");
eosio::check(ptr7[1] == ((__int128_t(0x8888888888888888) << 64) | 0x8888888888888888), "wrong value for __int128[2] #2");
eosio::check(ptr8[0] == 0x9999999999999999, "wrong value for long long[3] #1");
eosio::check(ptr8[1] == 0x9999999999999999, "wrong value for long long[3] #1");
eosio::check(ptr8[2] == 0x9999999999999999, "wrong value for long long[3] #1");
eosio::check(ptr9[0] == 0xAAAAAAAAAAAAAAAA, "wrong value for long long[3] #2");
eosio::check(ptr9[1] == 0xAAAAAAAAAAAAAAAA, "wrong value for long long[3] #2");
eosio::check(ptr9[2] == 0xAAAAAAAAAAAAAAAA, "wrong value for long long[3] #2");

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

No branches or pull requests

1 participant