aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2020-01-21 12:42:36 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2020-01-21 18:58:31 -0500
commit4f01e5778689977c9569477947b8062d8d866667 (patch)
treeab213e6c9fc028c38992299801ee2921bae87cc1 /libgo
parentc77074d05691053ee7347d9e44ab89b3adb23fb1 (diff)
downloadgcc-4f01e5778689977c9569477947b8062d8d866667.zip
gcc-4f01e5778689977c9569477947b8062d8d866667.tar.gz
gcc-4f01e5778689977c9569477947b8062d8d866667.tar.bz2
analyzer: fix qsort issue with array_region keys (PR 93352)
PR analyzer/93352 reports a qsort failure "comparator not anti-symmetric: -2147483648, -2147483648)" within the analyzer on code involving an array access of [0x7fffffff + 1]. The issue is that array_region (which uses int for keys into known values in the array) uses subtraction to implement int_cmp for sorting the keys, which isn't going to work for boundary values. Potentially a wider type should be used, but for now this patch fixes the ICE by using explicit comparisons rather than subtraction to implement the qsort callback. gcc/analyzer/ChangeLog: PR analyzer/93352 * region-model.cc (int_cmp): Rename to... (array_region::key_cmp): ...this, using key_t rather than int. Rewrite in terms of comparisons rather than subtraction to ensure qsort is anti-symmetric when handling extreme values. (array_region::walk_for_canonicalization): Update for above renaming. * region-model.h (array_region::key_cmp): New decl. gcc/testsuite/ChangeLog: PR analyzer/93352 * gcc.dg/analyzer/pr93352.c: New test.
Diffstat (limited to 'libgo')
0 files changed, 0 insertions, 0 deletions