Hello!
As noted in the PR, we also have to protect conversion from
round->lround for non-TARGET_C99_FUNCTIONS targets. Otherwise, gcc
chokes in fold_fixed_mathfn, trying to canonicalize iround to
(non-existent) lround. It looks to me, that we can trigger the same
problem trying to convert (long long) round -> llround -> lround on
non-TARGET_C99_FUNCTIONS LP64 targets, so this fix probably applies to
other release branches as well.
2011-08-25 Uros Bizjak <[email protected]>
PR middle-end/50083
* convert.c (convert_to_integer) <BUIT_IN_ROUND{,F,L}>: Convert
only when TARGET_C99_FUNCTIONS.
<BUILT_IN_NEARBYINT{,F,L}>: Ditto.
<BUILT_IN_RINT{,F,L}>: Ditto.
Bootstrapped on x86_64-pc-linux-gnu, regtesting in progress.
OK for SVN and 4.6?
Uros.
Index: convert.c
===================================================================
--- convert.c (revision 178071)
+++ convert.c (working copy)
@@ -469,6 +469,9 @@ convert_to_integer (tree type, tree expr)
break;
CASE_FLT_FN (BUILT_IN_ROUND):
+ /* Only convert in ISO C99 mode. */
+ if (!TARGET_C99_FUNCTIONS)
+ break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
&& !TYPE_UNSIGNED (type)))
@@ -487,11 +490,14 @@ convert_to_integer (tree type, tree expr)
break;
/* ... Fall through ... */
CASE_FLT_FN (BUILT_IN_RINT):
+ /* Only convert in ISO C99 mode. */
+ if (!TARGET_C99_FUNCTIONS)
+ break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
&& !TYPE_UNSIGNED (type)))
fn = mathfn_built_in (s_intype, BUILT_IN_IRINT);
- else if (outprec < TYPE_PRECISION (long_integer_type_node)
+ else if (outprec == TYPE_PRECISION (long_integer_type_node)
&& !TYPE_UNSIGNED (type))
fn = mathfn_built_in (s_intype, BUILT_IN_LRINT);
else if (outprec == TYPE_PRECISION (long_long_integer_type_node)