summaryrefslogtreecommitdiff
path: root/lib/argp-help.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-05-19 15:35:24 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-05-19 15:36:21 -0700
commita50e906c0c046c57938f786ffb82b36beea75043 (patch)
tree80da30229cef0331a39ed6ed4ff55e2f16aefb36 /lib/argp-help.c
parent5e0faf88718e9329e44c773039166c7dbf3ca57c (diff)
downloadgnulib-a50e906c0c046c57938f786ffb82b36beea75043.tar.gz
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
Diffstat (limited to 'lib/argp-help.c')
-rw-r--r--lib/argp-help.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/argp-help.c b/lib/argp-help.c
index 06329606a7..ce9bab9637 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. */