zephyriot / zephyr-issues

0 stars 0 forks source link

Build warnings [-Wshift-overflow] with LLVM/icx (K_MEM_POOL_DEFINE) #2017

Open nashif opened 7 years ago

nashif commented 7 years ago

Reported by Sharron LIU:

K_MEM_POOL_DEFINE with build warnings raised from LLVM/icx: tests/kernel/mem_pool/*

/home/sharron/workspace/views/iot/zephyr/tests/kernel/mem_pool/test_mpool/src/pool.c:38:1: warning:
      signed shift result (0x140000000) requires 34 bits to represent, but 'int'
      only has 32 bits [-Wshift-overflow]
K_MEM_POOL_DEFINE(SECOND_POOL_ID, 16, 1024, 5, 4);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sharron/workspace/views/iot/zephyr/include/kernel.h:3274:9: note:
      expanded from macro 'K_MEM_POOL_DEFINE'
                                  + _MPOOL_BITS_SIZE(maxsz, minsz, nmax)]; \
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sharron/workspace/views/iot/zephyr/include/kernel.h:3242:2: note:
      expanded from macro '_MPOOL_BITS_SIZE'
        _MPOOL_LBIT_BYTES(maxsz, minsz, 15, n_max))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sharron/workspace/views/iot/zephyr/include/kernel.h:3223:7: note:
      expanded from macro '_MPOOL_LBIT_BYTES'
         4 * _MPOOL_LBIT_WORDS((n_max), l) : 0)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sharron/workspace/views/iot/zephyr/include/kernel.h:3217:3: note:
      expanded from macro '_MPOOL_LBIT_WORDS'
        (_MPOOL_LBIT_WORDS_UNCLAMPED(n_max, l) < 2 ? 0  \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sharron/workspace/views/iot/zephyr/include/kernel.h:3211:13: note:
      expanded from macro '_MPOOL_LBIT_WORDS_UNCLAMPED'
        ((((n_max) << (2*(l))) + 31) / 32)
           ~~~~~~~ ^  ~~~~~~~

how-to-reproduce:

source zephyr-env.sh

export ZEPHYR_GCC_VARIANT=issm

cd tests/kernel/mem_pool/test_mpool

make pristine

make BOARD=quark_se_c1000_devboard CC=icx

(Imported from Jira ZEP-2179)

nashif commented 7 years ago

by rahul kumar:

nashif commented 7 years ago

by rahul kumar:

nashif commented 7 years ago

by rahul kumar:

nashif commented 7 years ago

by rahul kumar:

nashif commented 7 years ago

by rahul kumar:

Hi,

We are also seeing this issue with latest zepher drop(v1.8-rc1). But with this we seen [-Wdeprecated-declarations] warnings as well. Following mpool componets are giving compilation warnings:

Thanks

nashif commented 7 years ago

References GH-1734