mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-11 17:35:13 +00:00
![Marcin Kolny](/assets/img/avatar_default.png)
In some cases, the memory address of some variables may have 4 least significant bytes set to zero. Because we cast the pointer to int, we look only at 4 least significant bytes; the assertion may fail because 4 least significant bytes are 0. Change bh_assert implementation to cast the assert expr to int64_t and it works well with 64-bit architectures.
26 lines
555 B
C
26 lines
555 B
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#include "bh_assert.h"
|
|
|
|
void
|
|
bh_assert_internal(int64 v, const char *file_name, int line_number,
|
|
const char *expr_string)
|
|
{
|
|
if (v)
|
|
return;
|
|
|
|
if (!file_name)
|
|
file_name = "NULL FILENAME";
|
|
|
|
if (!expr_string)
|
|
expr_string = "NULL EXPR_STRING";
|
|
|
|
os_printf("\nASSERTION FAILED: %s, at file %s, line %d\n", expr_string,
|
|
file_name, line_number);
|
|
|
|
abort();
|
|
}
|