summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2016-03-21 04:35:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-21 16:18:07 (GMT)
commitd616fbf256ef3102669d450ddadd8469fefcf95c (patch)
treec80ec676a8d8a9914f3be3557028659755217e99 /git-compat-util.h
parent935de81289cd04b4736c538747c53df123c30d1c (diff)
downloadgit-d616fbf256ef3102669d450ddadd8469fefcf95c.zip
git-d616fbf256ef3102669d450ddadd8469fefcf95c.tar.gz
git-d616fbf256ef3102669d450ddadd8469fefcf95c.tar.bz2
git-compat-util: st_add4: work around gcc 4.2.x compiler crash
Although changes by 5b442c4 (tree-diff: catch integer overflow in combine_diff_path allocation, 2016-02-19) are perfectly valid, they unfortunately trigger an internal compiler error in gcc 4.2.x: combine-diff.c: In function 'diff_tree_combined': combine-diff.c:1391: internal compiler error: Segmentation fault: 11 Experimentation reveals that changing st_add4()'s argument evaluation order is sufficient to sidestep this problem. Although st_add3() does not trigger the compiler bug, for style consistency, change its argument evaluation order to match. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 061e33c..6d30461 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -713,8 +713,8 @@ static inline size_t st_add(size_t a, size_t b)
(uintmax_t)a, (uintmax_t)b);
return a + b;
}
-#define st_add3(a,b,c) st_add((a),st_add((b),(c)))
-#define st_add4(a,b,c,d) st_add((a),st_add3((b),(c),(d)))
+#define st_add3(a,b,c) st_add(st_add((a),(b)),(c))
+#define st_add4(a,b,c,d) st_add(st_add3((a),(b),(c)),(d))
static inline size_t st_mult(size_t a, size_t b)
{