[PATCH]: add folding of builtin modf

Richard Guenther richard.guenther@gmail.com
Sat Feb 24 20:06:00 GMT 2007


On 2/24/07, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
> This patch adds folding of builtin modf when the first argument is a
> constant.
>
> Tested on sparc-sun-solaris2.10, no regressions.
>
> Okay for mainline?

> +  /* Proceed if a valid pointer type was passed in.  */
> +  if (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) == TYPE_MAIN_VARIANT (rettype))

I wonder what happens for

double foo(double x)
{
  const double y;
  return modf (x, &y);
}

as the TYPE_MAIN_VARIANT is the same for double and const
double, but you certainly cannot write to y.

Richard.



More information about the Gcc-patches mailing list