aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2023-03-21 13:46:03 +0100
committerosmith <osmith@sysmocom.de>2023-03-21 15:24:37 +0000
commitadaa1c62e13a9ee8e7b978e6e9f67624f1ea7307 (patch)
treed23b48f62ee20c0405dc9a5b43e71829089bbfb2 /src
parentd762965f77eb4cfeca3715adf78616132871e0aa (diff)
INTEGER: ignore invalid -Warray-bounds from GCC-10
GCC 10.2.1 20210110 from Debian 11 generates an invalid Warray-bounds error. It was fixed in future GCC versions, I verified it with GCC 11.3.0. Ignore the warning, so we can build on Debian 11 with -Werror. Fix for: INTEGER.c: In function ‘asn_int642INTEGER’: INTEGER.c:1340:34: error: array subscript 0 is outside array bounds of ‘int64_t[1]’ {aka ‘long int[1]’} [-Werror=array-bounds] 1340 | for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) | ~~~~~~^~~~~~ INTEGER.c:1296:42: note: while referencing ‘value’ 1296 | asn_int642INTEGER(INTEGER_t *st, int64_t value) { | ~~~~~~~~^~~~~ Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93582 Change-Id: Ic10407e6d484ae29dc39edbdc6fcd0145e17e773
Diffstat (limited to 'src')
-rw-r--r--src/INTEGER.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/INTEGER.c b/src/INTEGER.c
index 042fd75..0da24ad 100644
--- a/src/INTEGER.c
+++ b/src/INTEGER.c
@@ -1336,9 +1336,16 @@ asn_int642INTEGER(INTEGER_t *st, int64_t value) {
}
break;
}
+#if __GNUC__ == 10
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
/* Copy the integer body */
for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
*bp++ = *p;
+#if __GNUC__ == 10
+#pragma GCC diagnostic pop
+#endif
if(st->buf) FREEMEM(st->buf);
st->buf = buf;
@@ -1391,9 +1398,16 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
}
break;
}
+#if __GNUC__ == 10
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
/* Copy the integer body */
for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
*bp++ = *p;
+#if __GNUC__ == 10
+#pragma GCC diagnostic pop
+#endif
if(st->buf) FREEMEM(st->buf);
st->buf = buf;