> -----Original Message----- > From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- > ow...@gcc.gnu.org] On Behalf Of Aldy Hernandez > Sent: Wednesday, October 16, 2013 1:49 PM > To: Jason Merrill > Cc: Richard Henderson; gcc-patches; Iyer, Balaji V > Subject: Re: PING: Fwd: Re: [patch] implement Cilk Plus simd loops on trunk > > On 10/02/13 16:53, Jason Merrill wrote: > > On 08/27/2013 04:03 PM, Aldy Hernandez wrote: > > > > >> + else if (!TREE_TYPE (e) || !TREE_CONSTANT (e) > >> + || !INTEGRAL_TYPE_P (TREE_TYPE (e))) > >> + cp_parser_error (parser, > >> + "step size must be an integer constant"); > > > > Can't the step size be a value-dependent expression like a template > > non-type parameter? > > [Balaji, this is for the linear clause that is either linear(var) or > linear(var : step)]. > > Jason, I'm not sure. The standard says: > > "The conditional-expression in a simd-linear-step shall either > satisfy the requirements of an integer constant expression, or > be a reference to a variable with integer type." > > I take this to mean, an integral expression or a plain old variable. Is this > the > case, Balaji? > Yup.
> Jason, are you asking about the validity of something like this: > > int *p; > > template <int argoop> > void foobar(int a) > { > int j = 123; > #pragma simd linear(j : argoop) > for (int i=0; i < a; ++i) > p[i] = argoop; > } > > void funky() > { > foobar <69> (1000); > } > > If this is what you're asking, and the above standardeese allows it, then we > have > a problem, because the code parsing the "j" in the linear clause uses > cp_parser_id_expression() which gets horrendously confused with the colon, > expecting a '::'. For that matter, even doing this causes problems: > In parser structure, there is a variable that called colon_corrects_to_scope_p. Set that to false right before searching for a colon. That should fix this looking for :: issue. > int j = 123, k = 456; > #pragma simd linear (j : k) > ... > > Is this what you were asking about? If so, then perhaps something besides > cp_parser_id_expression is in order, for the sake of the template argument or > just a plain variable. > Thanks, Balaji V. Iyer. > Aldy