Skip to content

Fix warnings in chained volatile assignments #332

@ericpassmore

Description

@ericpassmore

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions