On Fri, 2015-07-17 at 09:40 -0400, David Malcolm wrote:
> On Thu, 2015-07-16 at 11:00 +0200, Basile Starynkevitch wrote:

(snip)

> > + 
> > +/* Specialization of making an rvalue from a const, for host <long
> > long>.  */
> > +
> > +template <>
> > +rvalue *
> > +context::
> > +new_rvalue_from_const <long long> (type *type,
> > +                                  long long value)
> > +{
> > +  // FIXME: type-checking, or coercion?
> > +  tree inner_type = type->as_tree ();
> > +  if (INTEGRAL_TYPE_P (inner_type))
> > +    {
> > +      tree inner = build_int_cst (inner_type, value);
> > +      return new rvalue (this, inner);
> > +    }
> > +  else
> > +    {
> > +      REAL_VALUE_TYPE real_value;
> > +      real_from_integer (&real_value, VOIDmode, value, SIGNED);
> > +      tree inner = build_real (inner_type, real_value);
> > +      return new rvalue (this, inner);
> > +    }
> > +}
> 
> This is probably out-of-scope for this patch, but seeing this made me
> wonder if we ought to add a validation to the various
> "new_rvalue_from_TYPE" APIs to ensure that the host value will fit in
> the target type, and emit an error on the context if the given host
> value won't fit.

Filed as PR jit/66913 for now.  The validation would happen in
libgccjit.c.

(snip)


Reply via email to