On Sat, Dec 04, 2010 at 09:33:10AM +0100, Frits van Bommel wrote: > On Sat, Dec 4, 2010 at 2:50 AM, Peter Collingbourne <[email protected]> wrote: > > +def cl_single_precision_constant : Flag<"-cl-single-precision-constant">, > > + HelpText<"OpenCL only. Treat double precision floating-point constant as > > single precision constant.">; > > This claims the option is OpenCL only, but that doesn't seem to be > checked below: > > > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) > > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 3 19:50:56 2010 > > @@ -2394,6 +2394,9 @@ > > bool isExact = (result == APFloat::opOK); > > Res = FloatingLiteral::Create(Context, Val, isExact, Ty, > > Tok.getLocation()); > > > > + if (getLangOptions().SinglePrecisionConstants && Ty == > > Context.DoubleTy) > > + ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast); > > + > > } else if (!Literal.isIntegerLiteral()) { > > return ExprError(); > > } else { > >
Hi Frits, Using the -cl-* options when compiling non-OpenCL code is undefined behaviour. If you're using those options outside of OpenCL then you should know what you're doing (the options are clearly marked at being OpenCL only), especially since this is the frontend and not the driver. Note also that the C++ and Objective C only options are not conditional on the language. Thanks, -- Peter _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
