Skip to contentSkip to conversation

dead code in gf-complete

DISCUSSION Loic Dachary 1 participant 3 messages Dec 5, 2014 – Dec 8, 2014 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi Kevin & Janne,

Does the following ring a bell ? If not I'll figure it out ;-) It showed up with static analysis, after the NEON patch was merged (no static analysis is done before).

Cheers

/erasure-code/jerasure/gf-complete/src/gf_w32.c: 2309 in gf_w32_split_init()
2303 if ((h->arg1 == 4 && h->arg2 == 32) || (h->arg1 == 32 && h->arg2 == 4) ||
2304 ((issse3 || isneon) && h->mult_type == GF_REGION_DEFAULT)) {

2305         ld4 = (struct gf_split_4_32_lazy_data *) h->private;
2306         ld4->last_value = 0;
2307         if ((h->region_type & GF_REGION_NOSIMD) || !(issse3 || isneon)) {

2308 gf->multiply_region.w32 = gf_w32_split_4_32_lazy_multiply_region;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 1256941: Logically dead code (DEADCODE) Execution cannot reach this statement "if (isneon) {

} else if (h-...".
2309 } else if (isneon) {
2310 #ifdef ARM_NEON
2311 gf_w32_neon_split_init(gf);
2312 #endif
2313 } else if (h->region_type & GF_REGION_ALTMAP) {
2314 gf->multiply_region.w32 = gf_w32_split_4_32_lazy_sse_altmap_multiply_region;

________________________________________________________________________________________________________
*** CID 1256942: Logically dead code (DEADCODE) /erasure-code/jerasure/gf-complete/src/gf_w8.c: 1147 in gf_w8_table_init()
1141 use_simd = 1;
1142 #else
1143 use_simd = 0;
1144 #endif
1145
1146 if (h->mult_type == GF_MULT_DEFAULT && use_simd) {

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 1256942: Logically dead code (DEADCODE)
Execution cannot reach this statement "dd = (struct gf_w8_default_...".

1147         dd = (struct gf_w8_default_data *)h->private;
1148         scase = 3;
1149         bzero(dd->high, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
1150         bzero(dd->low, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
1151         bzero(dd->divtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);
1152         bzero(dd->multtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);
Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre

A message that is not in the archive (sent off-list or not yet received): CA+AFVBjtbVbmq_Hn+-DubpHy2i_eFUhiUhSKmg2dXeGgT=RChA@mail.gmail.com

#2 lore raw
Quoted 1 line · Kevin Greenan

I can take a look... Man, some of our conditional expressions and if-then-else chains are pretty ugly!

It works, that's beautiful ;-)

Quoted 50 lines

-kevin

On Fri, Dec 5, 2014 at 7:06 AM, Loic Dachary <[email protected] <mailto:[email protected]>> wrote:

    Hi Kevin & Janne,

    Does the following ring a bell ? If not I'll figure it out ;-) It showed up with static analysis, after the NEON patch was merged (no static analysis is done before).

    Cheers

    /erasure-code/jerasure/gf-complete/src/gf_w32.c: 2309 in gf_w32_split_init()
    2303       if ((h->arg1 == 4 && h->arg2 == 32) || (h->arg1 == 32 && h->arg2 == 4) ||
    2304           ((issse3 || isneon) && h->mult_type == GF_REGION_DEFAULT)) {
    2305         ld4 = (struct gf_split_4_32_lazy_data *) h->private;
    2306         ld4->last_value = 0;
    2307         if ((h->region_type & GF_REGION_NOSIMD) || !(issse3 || isneon)) {
    2308           gf->multiply_region.w32 = gf_w32_split_4_32_lazy_multiply_region;
    >>>     CID 1256941:  Logically dead code  (DEADCODE)
    >>>     Execution cannot reach this statement "if (isneon) {
    } else if (h-...".
    2309         } else if (isneon) {
    2310     #ifdef ARM_NEON
    2311           gf_w32_neon_split_init(gf);
    2312     #endif
    2313         } else if (h->region_type & GF_REGION_ALTMAP) {
    2314           gf->multiply_region.w32 = gf_w32_split_4_32_lazy_sse_altmap_multiply_region;

    ________________________________________________________________________________________________________
    *** CID 1256942:  Logically dead code  (DEADCODE)
    /erasure-code/jerasure/gf-complete/src/gf_w8.c: 1147 in gf_w8_table_init()
    1141       use_simd = 1;
    1142     #else
    1143       use_simd = 0;
    1144     #endif
    1145
    1146       if (h->mult_type == GF_MULT_DEFAULT && use_simd) {
    >>>     CID 1256942:  Logically dead code  (DEADCODE)
    >>>     Execution cannot reach this statement "dd = (struct gf_w8_default_...".
    1147         dd = (struct gf_w8_default_data *)h->private;
    1148         scase = 3;
    1149         bzero(dd->high, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
    1150         bzero(dd->low, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
    1151         bzero(dd->divtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);
    1152         bzero(dd->multtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);

    --
    Loïc Dachary, Artisan Logiciel Libre
Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre
#3 lore raw
In reply to a message not in the archive

Since both of you think this is a false positive, let's just ignore it.

Quoted 51 lines · Kevin Greenan

I can take a look... Man, some of our conditional expressions and if-then-else chains are pretty ugly!

-kevin

On Fri, Dec 5, 2014 at 7:06 AM, Loic Dachary <[email protected] <mailto:[email protected]>> wrote:

    Hi Kevin & Janne,

    Does the following ring a bell ? If not I'll figure it out ;-) It showed up with static analysis, after the NEON patch was merged (no static analysis is done before).

    Cheers

    /erasure-code/jerasure/gf-complete/src/gf_w32.c: 2309 in gf_w32_split_init()
    2303       if ((h->arg1 == 4 && h->arg2 == 32) || (h->arg1 == 32 && h->arg2 == 4) ||
    2304           ((issse3 || isneon) && h->mult_type == GF_REGION_DEFAULT)) {
    2305         ld4 = (struct gf_split_4_32_lazy_data *) h->private;
    2306         ld4->last_value = 0;
    2307         if ((h->region_type & GF_REGION_NOSIMD) || !(issse3 || isneon)) {
    2308           gf->multiply_region.w32 = gf_w32_split_4_32_lazy_multiply_region;
    >>>     CID 1256941:  Logically dead code  (DEADCODE)
    >>>     Execution cannot reach this statement "if (isneon) {
    } else if (h-...".
    2309         } else if (isneon) {
    2310     #ifdef ARM_NEON
    2311           gf_w32_neon_split_init(gf);
    2312     #endif
    2313         } else if (h->region_type & GF_REGION_ALTMAP) {
    2314           gf->multiply_region.w32 = gf_w32_split_4_32_lazy_sse_altmap_multiply_region;

    ________________________________________________________________________________________________________
    *** CID 1256942:  Logically dead code  (DEADCODE)
    /erasure-code/jerasure/gf-complete/src/gf_w8.c: 1147 in gf_w8_table_init()
    1141       use_simd = 1;
    1142     #else
    1143       use_simd = 0;
    1144     #endif
    1145
    1146       if (h->mult_type == GF_MULT_DEFAULT && use_simd) {
    >>>     CID 1256942:  Logically dead code  (DEADCODE)
    >>>     Execution cannot reach this statement "dd = (struct gf_w8_default_...".
    1147         dd = (struct gf_w8_default_data *)h->private;
    1148         scase = 3;
    1149         bzero(dd->high, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
    1150         bzero(dd->low, sizeof(uint8_t) * GF_FIELD_SIZE * GF_HALF_SIZE);
    1151         bzero(dd->divtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);
    1152         bzero(dd->multtable, sizeof(uint8_t) * GF_FIELD_SIZE * GF_FIELD_SIZE);

    --
    Loïc Dachary, Artisan Logiciel Libre
Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre