mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-19 21:43:27 +00:00
Fix -Warray-bounds warnings on gcc
With optimizations/inlining enabled GCC complains about gl - 10 resulting in a pointer to invalid memory when Dst is an array type rather than a pointer.
This commit is contained in:
parent
505e2c03de
commit
2be049069f
@ -9,6 +9,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned __int32 uintptr_t;
|
||||
#endif
|
||||
#elif defined(__symbian__)
|
||||
/* Cough. */
|
||||
typedef unsigned int uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define DASM_ARCH "arm"
|
||||
|
||||
#ifndef DASM_EXTERN
|
||||
@ -123,7 +137,7 @@ void dasm_free(Dst_DECL)
|
||||
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
|
||||
{
|
||||
dasm_State *D = Dst_REF;
|
||||
D->globals = gl - 10; /* Negative bias to compensate for locals. */
|
||||
D->globals = (void **)((uintptr_t)gl - 10); /* Negative bias to compensate for locals. */
|
||||
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned __int32 uintptr_t;
|
||||
#endif
|
||||
#elif defined(__symbian__)
|
||||
/* Cough. */
|
||||
typedef unsigned int uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define DASM_ARCH "arm64"
|
||||
|
||||
#ifndef DASM_EXTERN
|
||||
@ -125,7 +139,7 @@ void dasm_free(Dst_DECL)
|
||||
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
|
||||
{
|
||||
dasm_State *D = Dst_REF;
|
||||
D->globals = gl - 10; /* Negative bias to compensate for locals. */
|
||||
D->globals = (void **)((uintptr_t)gl - 10); /* Negative bias to compensate for locals. */
|
||||
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned __int32 uintptr_t;
|
||||
#endif
|
||||
#elif defined(__symbian__)
|
||||
/* Cough. */
|
||||
typedef unsigned int uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define DASM_ARCH "mips"
|
||||
|
||||
#ifndef DASM_EXTERN
|
||||
@ -122,7 +136,7 @@ void dasm_free(Dst_DECL)
|
||||
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
|
||||
{
|
||||
dasm_State *D = Dst_REF;
|
||||
D->globals = gl - 10; /* Negative bias to compensate for locals. */
|
||||
D->globals = (void **)((uintptr_t)gl - 10); /* Negative bias to compensate for locals. */
|
||||
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned __int32 uintptr_t;
|
||||
#endif
|
||||
#elif defined(__symbian__)
|
||||
/* Cough. */
|
||||
typedef unsigned int uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define DASM_ARCH "ppc"
|
||||
|
||||
#ifndef DASM_EXTERN
|
||||
@ -122,7 +136,7 @@ void dasm_free(Dst_DECL)
|
||||
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
|
||||
{
|
||||
dasm_State *D = Dst_REF;
|
||||
D->globals = gl - 10; /* Negative bias to compensate for locals. */
|
||||
D->globals = (void **)((uintptr_t)gl - 10); /* Negative bias to compensate for locals. */
|
||||
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned __int32 uintptr_t;
|
||||
#endif
|
||||
#elif defined(__symbian__)
|
||||
/* Cough. */
|
||||
typedef unsigned int uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define DASM_ARCH "x86"
|
||||
|
||||
#ifndef DASM_EXTERN
|
||||
@ -121,7 +135,7 @@ void dasm_free(Dst_DECL)
|
||||
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
|
||||
{
|
||||
dasm_State *D = Dst_REF;
|
||||
D->globals = gl - 10; /* Negative bias to compensate for locals. */
|
||||
D->globals = (void **)((uintptr_t)gl - 10); /* Negative bias to compensate for locals. */
|
||||
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user