>From 3f11d42a0e5afc742a0269224ea0236a6b65a47c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 19 May 2017 15:35:24 -0700 Subject: [PATCH 1/2] argp: fix pointer-subtraction bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/argp-help.c (hol_append): Don’t subtract pointers to different arrays, as this can run afoul of -fcheck-pointer-bounds. See the thread containing Bruno Haible’s report in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html --- ChangeLog | 8 ++++++++ lib/argp-help.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 889ef11..b214252 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-19 Paul Eggert + + argp: fix pointer-subtraction bug + * lib/argp-help.c (hol_append): Don’t subtract pointers to + different arrays, as this can run afoul of -fcheck-pointer-bounds. + See the thread containing Bruno Haible’s report in: + http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html + 2017-05-19 Bruno Haible printf-posix tests: Avoid test failure with "gcc --coverage". diff --git a/lib/argp-help.c b/lib/argp-help.c index 0632960..ce9bab9 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -880,7 +880,8 @@ hol_append (struct hol *hol, struct hol *more) /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) - e->short_options += (short_options - hol->short_options); + e->short_options + = short_options + (e->short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */ -- 2.9.4