From 2637bd27e86c30bce73f6753e922b1b2f03ad47d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 28 Jul 2014 08:47:38 +0000 Subject: re PR middle-end/52478 (-ftrapv calls the wrong functions in libgcc) 2014-07-28 Richard Biener 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 --- gcc/optabs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/optabs.c') 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); -- cgit v1.1