diff options
author | Richard Biener <rguenther@suse.de> | 2014-07-28 08:47:38 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-07-28 08:47:38 +0000 |
commit | 2637bd27e86c30bce73f6753e922b1b2f03ad47d (patch) | |
tree | 50c7abb69f3b2210ca85d4268d2632528cf587c0 /gcc/optabs.c | |
parent | 02b278a886da80a9432453993f5310cd760ca956 (diff) | |
download | gcc-2637bd27e86c30bce73f6753e922b1b2f03ad47d.zip gcc-2637bd27e86c30bce73f6753e922b1b2f03ad47d.tar.gz gcc-2637bd27e86c30bce73f6753e922b1b2f03ad47d.tar.bz2 |
re PR middle-end/52478 (-ftrapv calls the wrong functions in libgcc)
2014-07-28 Richard Biener <rguenther@suse.de>
PR middle-end/52478
* optabs.c (gen_int_libfunc): For -ftrapv libfuncs make
sure to register SImode ones, not only >= word_mode ones.
* expr.c (expand_expr_real_2): When expanding -ftrapv
binops do not use OPTAB_LIB_WIDEN.
* gcc.dg/torture/ftrapv-1.c: New testcase.
From-SVN: r213117
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index 7ee84c4..c7bd9d0 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -5559,13 +5559,17 @@ gen_int_libfunc (optab optable, const char *opname, char suffix, enum machine_mode mode) { int maxsize = 2 * BITS_PER_WORD; + int minsize = BITS_PER_WORD; if (GET_MODE_CLASS (mode) != MODE_INT) return; if (maxsize < LONG_LONG_TYPE_SIZE) maxsize = LONG_LONG_TYPE_SIZE; - if (GET_MODE_CLASS (mode) != MODE_INT - || GET_MODE_BITSIZE (mode) < BITS_PER_WORD + if (minsize > INT_TYPE_SIZE + && (trapv_binoptab_p (optable) + || trapv_unoptab_p (optable))) + minsize = INT_TYPE_SIZE; + if (GET_MODE_BITSIZE (mode) < minsize || GET_MODE_BITSIZE (mode) > maxsize) return; gen_libfunc (optable, opname, suffix, mode); |