Double assignment


(coulet ) #1

Dear support,
Currently SonarQube reports no issue if we implement this piece of C-code

varA = 1;
varA = 5;

this could be added in SonarQube
best regards,
Jean-Christophe Coulet

(Loïc Joly) #2

Hello Jean-Christophe,

You seem to be talking about S1854.

Do you have a valid code sample where this rule does not trigger any violation while it should?

Thank you,

(coulet ) #3

Here is a valid example

void test_function(uint8_t dummy)
    uint32_t a;
    uint32_t b;
     a = 15;
    memset(&b, 0, 4);
    a = 30;
    memcpy(&b, &a, 4);

best regards,
Jean-Christophe Coulet