bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.89k stars 623 forks source link

compiling with Wcast-align shows a huge number of warnings for THUMB #991

Open kfessel opened 2 years ago

kfessel commented 2 years ago

When compiling with Wcast-align and build traged beeing THUMB a huge number of warnings is shown.

RIOT uses Wcast-align by default i switched it of for the libwarm.a generation.

core/shared/mem-alloc/ems/ems_gc_internal.h:191:18: warning: cast increases required alignment of target type [-Wcast-align]
  191 |                ? (hmu_normal_node_t *)((uint8 *)node + node->next_offset)
``` -- The C compiler identification is GNU 9.2.1 -- The CXX compiler identification is GNU 9.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/arm-none-eabi-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/arm-none-eabi-gcc -- Build Configurations: Build as target THUMB CMAKE_BUILD_TYPE WAMR Interpreter enabled WAMR AOT disabled WAMR JIT disabled Libc builtin enabled Libc WASI disabled Fast interpreter disabled Multiple modules disabled Reference types disabled -- Configuring done -- Generating done -- Build files have been written to: .../examples/wasm/bin/nucleo-f767zi/pkg-build/wamr make -C .../examples/wasm/bin/nucleo-f767zi/pkg-build/wamr Scanning dependencies of target wamr [ 3%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/platform/riot/riot_platform.c.obj [ 7%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/platform/riot/riot_thread.c.obj [ 10%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/platform/riot/riot_time.c.obj [ 14%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/mem-alloc/ems/ems_alloc.c.obj In file included from .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:6: .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h: In function 'get_hmu_normal_node_next': .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h:191:18: warning: cast increases required alignment of target type [-Wcast-align] 191 | ? (hmu_normal_node_t *)((uint8 *)node + node->next_offset) | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c: In function 'hmu_set_free_size': .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:189:7: warning: cast increases required alignment of target type [-Wcast-align] 189 | *((uint32 *)((char *)hmu + size) - 1) = size; | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c: In function 'alloc_hmu': .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:332:24: warning: cast increases required alignment of target type [-Wcast-align] 332 | rest = (hmu_t *)(((char *)p) + size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:340:24: warning: cast increases required alignment of target type [-Wcast-align] 340 | next = (hmu_t *)((char *)p + size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:388:20: warning: cast increases required alignment of target type [-Wcast-align] 388 | rest = (hmu_t *)((char *)last_tp + size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:395:20: warning: cast increases required alignment of target type [-Wcast-align] 395 | next = (hmu_t *)((char *)last_tp + size); | ^ In file included from .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:6: .../wamr/core/shared/mem-alloc/ems/ems_alloc.c: In function 'gc_realloc_vo': .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h:117:26: warning: cast increases required alignment of target type [-Wcast-align] 117 | #define obj_to_hmu(obj) ((hmu_t *)((gc_uint8 *)(obj)-OBJ_PREFIX_SIZE) - 1) | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:525:19: note: in expansion of macro 'obj_to_hmu' 525 | hmu_old = obj_to_hmu(obj_old); | ^~~~~~~~~~ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:538:20: warning: cast increases required alignment of target type [-Wcast-align] 538 | hmu_next = (hmu_t *)((char *)hmu_old + tot_size_old); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:555:32: warning: cast increases required alignment of target type [-Wcast-align] 555 | hmu_next = (hmu_t *)((char *)hmu_old + tot_size); | ^ In file included from .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:6: .../wamr/core/shared/mem-alloc/ems/ems_alloc.c: In function 'gc_free_vo': .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h:117:26: warning: cast increases required alignment of target type [-Wcast-align] 117 | #define obj_to_hmu(obj) ((hmu_t *)((gc_uint8 *)(obj)-OBJ_PREFIX_SIZE) - 1) | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:648:11: note: in expansion of macro 'obj_to_hmu' 648 | hmu = obj_to_hmu(obj); | ^~~~~~~~~~ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:674:24: warning: cast increases required alignment of target type [-Wcast-align] 674 | prev = (hmu_t *)((char *)hmu - *((int *)hmu - 1)); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:687:20: warning: cast increases required alignment of target type [-Wcast-align] 687 | next = (hmu_t *)((char *)hmu + size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:695:28: warning: cast increases required alignment of target type [-Wcast-align] 695 | next = (hmu_t *)((char *)hmu + size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c: In function 'gci_dump': .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:747:11: warning: cast increases required alignment of target type [-Wcast-align] 747 | cur = (hmu_t *)heap->base_addr; | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:748:11: warning: cast increases required alignment of target type [-Wcast-align] 748 | end = (hmu_t *)((char *)heap->base_addr + heap->current_size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_alloc.c:780:15: warning: cast increases required alignment of target type [-Wcast-align] 780 | cur = (hmu_t *)((char *)cur + size); | ^ [ 17%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/mem-alloc/ems/ems_hmu.c.obj In file included from .../wamr/core/shared/mem-alloc/ems/ems_hmu.c:6: .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h: In function 'get_hmu_normal_node_next': .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h:191:18: warning: cast increases required alignment of target type [-Wcast-align] 191 | ? (hmu_normal_node_t *)((uint8 *)node + node->next_offset) | ^ [ 21%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/mem-alloc/ems/ems_kfc.c.obj In file included from .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:6: .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h: In function 'get_hmu_normal_node_next': .../wamr/core/shared/mem-alloc/ems/ems_gc_internal.h:191:18: warning: cast increases required alignment of target type [-Wcast-align] 191 | ? (hmu_normal_node_t *)((uint8 *)node + node->next_offset) | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c: In function 'gc_init_internal': .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:37:9: warning: cast increases required alignment of target type [-Wcast-align] 37 | q = (hmu_tree_node_t *)heap->base_addr; | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c: In function 'gc_init_with_pool': .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:58:23: warning: cast increases required alignment of target type [-Wcast-align] 58 | gc_heap_t *heap = (gc_heap_t *)buf_aligned; | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c: In function 'gc_init_with_struct_and_pool': .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:85:23: warning: cast increases required alignment of target type [-Wcast-align] 85 | gc_heap_t *heap = (gc_heap_t *)struct_buf; | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c: In function 'gc_migrate': .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:196:11: warning: cast increases required alignment of target type [-Wcast-align] 196 | cur = (hmu_t *)heap->base_addr; | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:197:11: warning: cast increases required alignment of target type [-Wcast-align] 197 | end = (hmu_t *)((char *)heap->base_addr + heap->current_size); | ^ .../wamr/core/shared/mem-alloc/ems/ems_kfc.c:217:15: warning: cast increases required alignment of target type [-Wcast-align] 217 | cur = (hmu_t *)((char *)cur + size); | ^ [ 25%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/mem-alloc/mem_alloc.c.obj [ 28%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_assert.c.obj [ 32%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_common.c.obj [ 35%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_hashmap.c.obj .../wamr/core/shared/utils/bh_hashmap.c: In function 'bh_hash_map_create': .../wamr/core/shared/utils/bh_hashmap.c:59:21: warning: cast increases required alignment of target type [-Wcast-align] 59 | map->lock = (korp_mutex *)((uint8 *)map + offsetof(HashMap, elements) | ^ [ 39%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_list.c.obj [ 42%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_log.c.obj [ 46%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_queue.c.obj [ 50%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/bh_vector.c.obj [ 53%] Building C object CMakeFiles/wamr.dir.../wamr/core/shared/utils/runtime_timer.c.obj [ 57%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c.obj .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c: In function '_vprintf_wa': .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:262:29: note: in expansion of macro '_va_arg' 262 | d = _va_arg(ap, int32); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:267:31: note: in expansion of macro '_va_arg' 267 | lld = _va_arg(ap, int64); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:289:29: note: in expansion of macro '_va_arg' 289 | u = _va_arg(ap, uint32); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:294:31: note: in expansion of macro '_va_arg' 294 | llu = _va_arg(ap, uint64); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:319:29: note: in expansion of macro '_va_arg' 319 | x = _va_arg(ap, uint32); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:323:29: note: in expansion of macro '_va_arg' 323 | x = _va_arg(ap, uint64); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:336:32: note: in expansion of macro '_va_arg' 336 | s_offset = _va_arg(ap, uint32); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:360:25: note: in expansion of macro '_va_arg' 360 | c = _va_arg(ap, int); | ^~~~~~~ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:72:26: warning: cast increases required alignment of target type [-Wcast-align] 72 | #define _va_arg(ap, t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) | ^ .../wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:379:27: note: in expansion of macro '_va_arg' 379 | f64 = _va_arg(ap, float64); | ^~~~~~~ [ 60%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_application.c.obj .../wamr/core/iwasm/common/wasm_application.c: In function 'wasm_application_execute_main': .../wamr/core/iwasm/common/wasm_application.c:176:24: warning: cast increases required alignment of target type [-Wcast-align] 176 | argv_offsets = (uint32 *)(p + total_argv_size); | ^ [ 64%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_c_api.c.obj .../wamr/core/iwasm/common/wasm_c_api.c:17: warning: "UNREACHABLE" redefined 17 | #define UNREACHABLE() bh_assert(!"unreachable") | In file included from .../core/include/panic.h:25, from .../core/include/assert.h:25, from /usr/include/newlib/sys/reent.h:503, from /usr/include/newlib/string.h:11, from .../wamr/core/iwasm/common/../include/wasm_c_api.h:9, from .../wamr/core/iwasm/common/wasm_c_api_internal.h:9, from .../wamr/core/iwasm/common/wasm_c_api.c:6: .../core/include/kernel_defines.h:120: note: this is the location of the previous definition 120 | #define UNREACHABLE() __builtin_unreachable() | .../wamr/core/iwasm/common/wasm_c_api.c: In function 'rt_val_to_wasm_val': .../wamr/core/iwasm/common/wasm_c_api.c:1235:29: warning: cast increases required alignment of target type [-Wcast-align] 1235 | out->of.i32 = *((int32 *)data); | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1239:29: warning: cast increases required alignment of target type [-Wcast-align] 1239 | out->of.f32 = *((float32 *)data); | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1243:29: warning: cast increases required alignment of target type [-Wcast-align] 1243 | out->of.i64 = *((int64 *)data); | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1247:29: warning: cast increases required alignment of target type [-Wcast-align] 1247 | out->of.f64 = *((float64 *)data); | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_val_to_rt_val': .../wamr/core/iwasm/common/wasm_c_api.c:1276:15: warning: cast increases required alignment of target type [-Wcast-align] 1276 | *((int32 *)data) = v->of.i32; | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1280:15: warning: cast increases required alignment of target type [-Wcast-align] 1280 | *((float32 *)data) = v->of.f32; | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1284:15: warning: cast increases required alignment of target type [-Wcast-align] 1284 | *((int64 *)data) = v->of.i64; | ^ .../wamr/core/iwasm/common/wasm_c_api.c:1288:15: warning: cast increases required alignment of target type [-Wcast-align] 1288 | *((float64 *)data) = v->of.f64; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_trap_new_internal': .../wamr/core/iwasm/common/wasm_c_api.c:1602:11: warning: cast increases required alignment of target type [-Wcast-align] 1602 | (((wasm_frame_t *)trap->frames->data) + i)->instance = frame_instance; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_trap_origin': .../wamr/core/iwasm/common/wasm_c_api.c:1665:20: warning: cast increases required alignment of target type [-Wcast-align] 1665 | latest_frame = (wasm_frame_t *)trap->frames->data; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_trap_trace': .../wamr/core/iwasm/common/wasm_c_api.c:1691:18: warning: cast increases required alignment of target type [-Wcast-align] 1691 | frame = ((wasm_frame_t *)trap->frames->data) + i; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'params_to_argv': .../wamr/core/iwasm/common/wasm_c_api.c:2537:18: warning: cast increases required alignment of target type [-Wcast-align] 2537 | *(int64 *)argv = param->of.i64; | ^ .../wamr/core/iwasm/common/wasm_c_api.c:2547:18: warning: cast increases required alignment of target type [-Wcast-align] 2547 | *(float64 *)argv = param->of.f64; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'argv_to_results': .../wamr/core/iwasm/common/wasm_c_api.c:2595:35: warning: cast increases required alignment of target type [-Wcast-align] 2595 | result->of.i64 = *(int64 *)(argv + argv_i); | ^ .../wamr/core/iwasm/common/wasm_c_api.c:2609:35: warning: cast increases required alignment of target type [-Wcast-align] 2609 | result->of.f64 = *(float64 *)(argv + argv_i); | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_table_get': .../wamr/core/iwasm/common/wasm_c_api.c:3294:20: warning: cast increases required alignment of target type [-Wcast-align] 3294 | ref_idx = ((uint32 *)table_interp->base_addr)[index]; | ^ .../wamr/core/iwasm/common/wasm_c_api.c: In function 'wasm_table_set': .../wamr/core/iwasm/common/wasm_c_api.c:3366:22: warning: cast increases required alignment of target type [-Wcast-align] 3366 | p_ref_idx = ((uint32 *)table_interp->base_addr) + index; | ^ [ 67%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_exec_env.c.obj [ 71%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_memory.c.obj [ 75%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_native.c.obj [ 78%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_runtime_common.c.obj .../wamr/core/iwasm/common/wasm_runtime_common.c: In function 'exchange_uint64': .../wamr/core/iwasm/common/wasm_runtime_common.c:3903:14: warning: cast increases required alignment of target type [-Wcast-align] 3903 | value = *(uint32 *)p_data; | ^ .../wamr/core/iwasm/common/wasm_runtime_common.c:3904:6: warning: cast increases required alignment of target type [-Wcast-align] 3904 | *(uint32 *)p_data = *(uint32 *)(p_data + 4); | ^ .../wamr/core/iwasm/common/wasm_runtime_common.c:3904:26: warning: cast increases required alignment of target type [-Wcast-align] 3904 | *(uint32 *)p_data = *(uint32 *)(p_data + 4); | ^ .../wamr/core/iwasm/common/wasm_runtime_common.c:3905:6: warning: cast increases required alignment of target type [-Wcast-align] 3905 | *(uint32 *)(p_data + 4) = value; | ^ [ 82%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/wasm_shared_memory.c.obj [ 85%] Building ASM object CMakeFiles/wamr.dir.../wamr/core/iwasm/common/arch/invokeNative_thumb.s.obj [ 89%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/interpreter/wasm_interp_classic.c.obj .../wamr/core/iwasm/interpreter/wasm_interp_classic.c: In function 'wasm_interp_call_func_bytecode': .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1273:25: warning: cast increases required alignment of target type [-Wcast-align] 1273 | fidx = ((uint32 *)tbl_inst->base_addr)[val]; | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1554:27: warning: cast increases required alignment of target type [-Wcast-align] 1554 | PUSH_I32(*(uint32 *)global_addr); | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:209:40: note: in definition of macro 'PUSH_I32' 209 | *(int32 *)frame_sp++ = (int32)(value); \ | ^~~~~ In file included from .../wamr/core/iwasm/interpreter/wasm_runtime.h:11, from .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:8: .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1564:44: warning: cast increases required alignment of target type [-Wcast-align] 1564 | PUSH_I64(GET_I64_FROM_ADDR((uint32 *)global_addr)); | ^ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:75:25: note: in definition of macro 'PUT_I64_TO_ADDR' 75 | u.val = (int64)(value); \ | ^~~~~ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1564:17: note: in expansion of macro 'PUSH_I64' 1564 | PUSH_I64(GET_I64_FROM_ADDR((uint32 *)global_addr)); | ^~~~~~~~ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1574:18: warning: cast increases required alignment of target type [-Wcast-align] 1574 | *(int32 *)global_addr = POP_I32(); | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1596:18: warning: cast increases required alignment of target type [-Wcast-align] 1596 | *(int32 *)global_addr = aux_stack_top; | ^ In file included from .../wamr/core/iwasm/interpreter/wasm_runtime.h:11, from .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:8: .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1615:33: warning: cast increases required alignment of target type [-Wcast-align] 1615 | PUT_I64_TO_ADDR((uint32 *)global_addr, POP_I64()); | ^ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:70:39: note: in definition of macro 'PUT_I64_TO_ADDR' 70 | uint32 *addr_u32 = (uint32 *)(addr); \ | ^~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:156:14: warning: cast increases required alignment of target type [-Wcast-align] 156 | *(uint32 *)(addr) = (uint32)(value); \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1790:17: note: in expansion of macro 'STORE_U32' 1790 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:160:18: warning: cast increases required alignment of target type [-Wcast-align] 160 | ((uint16 *)(addr))[0] = u.u16[0]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1790:17: note: in expansion of macro 'STORE_U32' 1790 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:161:18: warning: cast increases required alignment of target type [-Wcast-align] 161 | ((uint16 *)(addr))[1] = u.u16[1]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1790:17: note: in expansion of macro 'STORE_U32' 1790 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:156:14: warning: cast increases required alignment of target type [-Wcast-align] 156 | *(uint32 *)(addr) = (uint32)(value); \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1805:17: note: in expansion of macro 'STORE_U32' 1805 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:160:18: warning: cast increases required alignment of target type [-Wcast-align] 160 | ((uint16 *)(addr))[0] = u.u16[0]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1805:17: note: in expansion of macro 'STORE_U32' 1805 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:161:18: warning: cast increases required alignment of target type [-Wcast-align] 161 | ((uint16 *)(addr))[1] = u.u16[1]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1805:17: note: in expansion of macro 'STORE_U32' 1805 | STORE_U32(maddr, frame_sp[1]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:156:14: warning: cast increases required alignment of target type [-Wcast-align] 156 | *(uint32 *)(addr) = (uint32)(value); \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1806:17: note: in expansion of macro 'STORE_U32' 1806 | STORE_U32(maddr + 4, frame_sp[2]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:160:18: warning: cast increases required alignment of target type [-Wcast-align] 160 | ((uint16 *)(addr))[0] = u.u16[0]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1806:17: note: in expansion of macro 'STORE_U32' 1806 | STORE_U32(maddr + 4, frame_sp[2]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:161:18: warning: cast increases required alignment of target type [-Wcast-align] 161 | ((uint16 *)(addr))[1] = u.u16[1]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1806:17: note: in expansion of macro 'STORE_U32' 1806 | STORE_U32(maddr + 4, frame_sp[2]); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:156:14: warning: cast increases required alignment of target type [-Wcast-align] 156 | *(uint32 *)(addr) = (uint32)(value); \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1859:21: note: in expansion of macro 'STORE_U32' 1859 | STORE_U32(maddr, (uint32)sval); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:160:18: warning: cast increases required alignment of target type [-Wcast-align] 160 | ((uint16 *)(addr))[0] = u.u16[0]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1859:21: note: in expansion of macro 'STORE_U32' 1859 | STORE_U32(maddr, (uint32)sval); | ^~~~~~~~~ .../wamr/core/iwasm/interpreter/../common/wasm_runtime_common.h:161:18: warning: cast increases required alignment of target type [-Wcast-align] 161 | ((uint16 *)(addr))[1] = u.u16[1]; \ | ^ .../wamr/core/iwasm/interpreter/wasm_interp_classic.c:1859:21: note: in expansion of macro 'STORE_U32' 1859 | STORE_U32(maddr, (uint32)sval); | ^~~~~~~~~ [ 92%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/interpreter/wasm_loader.c.obj .../wamr/core/iwasm/interpreter/wasm_loader.c: In function 'load': .../wamr/core/iwasm/interpreter/wasm_loader.c:21:26: warning: cast increases required alignment of target type [-Wcast-align] 21 | (p += sizeof(Type), *(Type *)(p - sizeof(Type))) | ^ .../wamr/core/iwasm/interpreter/wasm_loader.c:167:24: note: in expansion of macro 'TEMPLATE_READ_VALUE' 167 | #define read_uint32(p) TEMPLATE_READ_VALUE(uint32, p) | ^~~~~~~~~~~~~~~~~~~ .../wamr/core/iwasm/interpreter/wasm_loader.c:3430:20: note: in expansion of macro 'read_uint32' 3430 | magic_number = read_uint32(p); | ^~~~~~~~~~~ .../wamr/core/iwasm/interpreter/wasm_loader.c:21:26: warning: cast increases required alignment of target type [-Wcast-align] 21 | (p += sizeof(Type), *(Type *)(p - sizeof(Type))) | ^ .../wamr/core/iwasm/interpreter/wasm_loader.c:167:24: note: in expansion of macro 'TEMPLATE_READ_VALUE' 167 | #define read_uint32(p) TEMPLATE_READ_VALUE(uint32, p) | ^~~~~~~~~~~~~~~~~~~ .../wamr/core/iwasm/interpreter/wasm_loader.c:3440:15: note: in expansion of macro 'read_uint32' 3440 | version = read_uint32(p); | ^~~~~~~~~~~ [ 96%] Building C object CMakeFiles/wamr.dir.../wamr/core/iwasm/interpreter/wasm_runtime.c.obj .../wamr/core/iwasm/interpreter/wasm_runtime.c: In function 'memory_instantiate': .../wamr/core/iwasm/interpreter/wasm_runtime.c:227:14: warning: cast increases required alignment of target type [-Wcast-align] 227 | *(uint32 *)global_addr = aux_heap_base; | ^ .../wamr/core/iwasm/interpreter/wasm_runtime.c: In function 'wasm_instantiate': .../wamr/core/iwasm/interpreter/wasm_runtime.c:1278:22: warning: cast increases required alignment of target type [-Wcast-align] 1278 | *(int32 *)global_data = global->initial_value.i32; | ^ .../wamr/core/iwasm/interpreter/wasm_runtime.c:1402:30: warning: cast increases required alignment of target type [-Wcast-align] 1402 | uint32 *table_data = (uint32 *)table->base_addr; | ^ .../wamr/core/iwasm/interpreter/wasm_runtime.c: In function 'wasm_call_indirect': .../wamr/core/iwasm/interpreter/wasm_runtime.c:2264:25: warning: cast increases required alignment of target type [-Wcast-align] 2264 | function_indices = ((uint32_t *)table_inst->base_addr)[element_indices]; | ^ [100%] Linking C static library libwamr.a [100%] Built target wamr ```
wenyongh commented 2 years ago

Hi, have you found any issue when using WAMR in Thumb? If not, could you please disable -Wcast-align when building libwarm.a? It really takes effort to clear the warnings, which aren't reported by other targets.

kfessel commented 2 years ago

Thanks for taking a look. For the moment i removed that FLAG for the compilation of WAMR on RIOT, which uses it throughout most of its build process and allready spotted a number of (security) bugs.

I just wanted to make you aware of this issue. -and me-

Please have this open as a reminder until it is solved