From: Jan Hubicka Date: Wed, 23 Oct 2019 20:01:25 +0000 (+0200) Subject: lto-streamer-out.c (cmp_symbol_files): Watch for overflow. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c1bc95a48ba184da800007a5eb123f8ca81c509;p=gcc.git lto-streamer-out.c (cmp_symbol_files): Watch for overflow. * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. From-SVN: r277348 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c0c9ec6ee..b975798166c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-10-23 Jan Hubicka + + * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. + 2019-10-23 Jan Hubicka * ipa-reference.c (varpool_removal_hook, ipa_reference_c_finalize): Fix diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 2c712926f32..3ecadddec52 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2447,7 +2447,12 @@ cmp_symbol_files (const void *pn1, const void *pn2) /* Order within static library. */ if (n1->lto_file_data && n1->lto_file_data->id != n2->lto_file_data->id) - return n1->lto_file_data->id - n2->lto_file_data->id; + { + if (n1->lto_file_data->id > n2->lto_file_data->id) + return 1; + if (n1->lto_file_data->id < n2->lto_file_data->id) + return -1; + } /* And finaly order by the definition order. */ return n1->order - n2->order;