From: hubicka Date: Wed, 23 Oct 2019 20:01:25 +0000 (+0000) Subject: * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa0ba62796dc179ff622eab0f2fa1976f1ba98c0;p=thirdparty%2Fgcc.git * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277348 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c0c9ec6ee0..b975798166ce 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 2c712926f32a..3ecadddec528 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;