Clear Uninit Memory Read (UMR) when filling class / structure

I experience a rather annoying side effect of class / structure deposition with Purify . For instance.

struct something {
    int field1;
    char field2;
};

/* ... */

struct something smth, smth2;
smth.field1 = 1;
smth.field2 = 'A';

smth2 = smth;

The last line is likely to trigger a UMR warning saying that 3 bytes of initialized memory are available. This is obviously false positive: there is no user data in the last three bytes of the structure, this is just an addition.

Often warnings fill log files very quickly, making it very difficult to view other real problems.

Does anyone know a way to suppress false positives?

+3
source share
1 answer

, , , :

struct something smth = {0};
struct something smth2;

, scope (not file). , .

0

Source: https://habr.com/ru/post/1755711/


All Articles