osmith has submitted this change. (
https://gerrit.osmocom.org/c/libasn1c/+/31995 )
Change subject: INTEGER: ignore invalid -Warray-bounds from GCC-10
......................................................................
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
---
M src/INTEGER.c
1 file changed, 37 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
osmith: Looks good to me, approved
Jenkins Builder: Verified
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 @@
}
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 @@
}
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;
--
To view, visit
https://gerrit.osmocom.org/c/libasn1c/+/31995
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libasn1c
Gerrit-Branch: master
Gerrit-Change-Id: Ic10407e6d484ae29dc39edbdc6fcd0145e17e773
Gerrit-Change-Number: 31995
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged