From: Jakub Jelinek Date: Tue, 12 Mar 2019 08:17:08 +0000 (+0100) Subject: re PR middle-end/89663 (ICE in expand_builtin_int_roundingfn_2, at builtins.c:2831) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c178a5af523f2baf7c0501f86190ea3e2a45cbf;p=gcc.git re PR middle-end/89663 (ICE in expand_builtin_int_roundingfn_2, at builtins.c:2831) PR middle-end/89663 * builtins.c (expand_builtin_int_roundingfn, expand_builtin_int_roundingfn_2): Return NULL_RTX instead of gcc_unreachable if validate_arglist fails. * gcc.c-torture/compile/pr89663-1.c: New test. * gcc.c-torture/compile/pr89663-2.c: New test. From-SVN: r269605 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85d11c95dd4..87aa2aa2f5c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-03-12 Jakub Jelinek + + PR middle-end/89663 + * builtins.c (expand_builtin_int_roundingfn, + expand_builtin_int_roundingfn_2): Return NULL_RTX instead of + gcc_unreachable if validate_arglist fails. + 2019-03-12 Richard Biener PR tree-optimization/89664 diff --git a/gcc/builtins.c b/gcc/builtins.c index a65eb88bc49..93f829fa90b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2692,7 +2692,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target) tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) - gcc_unreachable (); + return NULL_RTX; arg = CALL_EXPR_ARG (exp, 0); @@ -2828,7 +2828,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target) enum built_in_function fallback_fn = BUILT_IN_NONE; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) - gcc_unreachable (); + return NULL_RTX; arg = CALL_EXPR_ARG (exp, 0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c4f79ae7254..9b20bdfe787 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-12 Jakub Jelinek + + PR middle-end/89663 + * gcc.c-torture/compile/pr89663-1.c: New test. + * gcc.c-torture/compile/pr89663-2.c: New test. + 2019-03-12 Richard Biener PR tree-optimization/89664 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c b/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c new file mode 100644 index 00000000000..4fc2d0d4cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89663-1.c @@ -0,0 +1,81 @@ +/* PR middle-end/89663 */ + +int irint (); +long lrint (); +long long llrint (); +int iround (); +long lround (); +long long llround (); +int iceil (); +long lceil (); +long long llceil (); +int ifloor (); +long lfloor (); +long long llfloor (); +int irintf (); +long lrintf (); +long long llrintf (); +int iroundf (); +long lroundf (); +long long llroundf (); +int iceilf (); +long lceilf (); +long long llceilf (); +int ifloorf (); +long lfloorf (); +long long llfloorf (); +int irintl (); +long lrintl (); +long long llrintl (); +int iroundl (); +long lroundl (); +long long llroundl (); +int iceill (); +long lceill (); +long long llceill (); +int ifloorl (); +long lfloorl (); +long long llfloorl (); + +void +foo (long long *p) +{ + int n = 0; +#define T(f) p[n++] = f (1); + T (irint) + T (lrint) + T (llrint) + T (iround) + T (lround) + T (llround) + T (iceil) + T (lceil) + T (llceil) + T (ifloor) + T (lfloor) + T (llfloor) + T (irintf) + T (lrintf) + T (llrintf) + T (iroundf) + T (lroundf) + T (llroundf) + T (iceilf) + T (lceilf) + T (llceilf) + T (ifloorf) + T (lfloorf) + T (llfloorf) + T (irintl) + T (lrintl) + T (llrintl) + T (iroundl) + T (lroundl) + T (llroundl) + T (iceill) + T (lceill) + T (llceill) + T (ifloorl) + T (lfloorl) + T (llfloorl) +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c new file mode 100644 index 00000000000..052fe69f40e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c @@ -0,0 +1,82 @@ +/* PR middle-end/89663 */ + +int irint (double); +long lrint (double); +long long llrint (double); +int iround (double); +long lround (double); +long long llround (double); +int iceil (double); +long lceil (double); +long long llceil (double); +int ifloor (double); +long lfloor (double); +long long llfloor (double); +int irintf (float); +long lrintf (float); +long long llrintf (float); +int iroundf (float); +long lroundf (float); +long long llroundf (float); +int iceilf (float); +long lceilf (float); +long long llceilf (float); +int ifloorf (float); +long lfloorf (float); +long long llfloorf (float); +int irintl (long double); +long lrintl (long double); +long long llrintl (long double); +int iroundl (long double); +long lroundl (long double); +long long llroundl (long double); +int iceill (long double); +long lceill (long double); +long long llceill (long double); +int ifloorl (long double); +long lfloorl (long double); +long long llfloorl (long double); + +void +foo (long long *p) +{ + int (*fn) (int); + int n = 0; +#define T(f) fn = (int (*) (int)) f; p[n++] = fn (1); + T (irint) + T (lrint) + T (llrint) + T (iround) + T (lround) + T (llround) + T (iceil) + T (lceil) + T (llceil) + T (ifloor) + T (lfloor) + T (llfloor) + T (irintf) + T (lrintf) + T (llrintf) + T (iroundf) + T (lroundf) + T (llroundf) + T (iceilf) + T (lceilf) + T (llceilf) + T (ifloorf) + T (lfloorf) + T (llfloorf) + T (irintl) + T (lrintl) + T (llrintl) + T (iroundl) + T (lroundl) + T (llroundl) + T (iceill) + T (lceill) + T (llceill) + T (ifloorl) + T (lfloorl) + T (llfloorl) +}