chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH 1/1] Fix spurious array bounds warnings on Open


From: Evan Hanson
Subject: [Chicken-hackers] [PATCH 1/1] Fix spurious array bounds warnings on OpenBSD
Date: Thu, 19 Jan 2017 22:20:12 +1300

This changes the fallback definition of C_block_item used for non-C99
compilers to use a slight variation on the "struct hack", where instead
of using 1 for the size of its data field, we use the largest possible
size. This increases the value that the compiler uses for bound analysis
in order to stop the array size warnings.

Fixes #1107.
---
 chicken.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chicken.h b/chicken.h
index e610f419..92c169e9 100644
--- a/chicken.h
+++ b/chicken.h
@@ -770,7 +770,7 @@ typedef struct C_block_struct
 #if (__STDC_VERSION__ >= 199901L)
   C_word data[];
 #else
-  C_word data[ 1 ];
+  C_word data[ INT_MAX ];
 #endif
 } C_SCHEME_BLOCK;
 
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]