On Fri, Jan 10, 2025 at 10:45:18AM +0100, Jakub Jelinek wrote: > Hi! > > Seems I forgot to set_c_expr_source_range for the __builtin_stdc_rotate_* > case (the other __builtin_stdc_* cases already have it), which means > the locations in expr are uninitialized, sometimes causing ICEs in linemap > code, at other times just valgrind errors about uninitialized var uses. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok. > 2025-01-10 Jakub Jelinek <ja...@redhat.com> > > PR c/118376 > * c-parser.cc (c_parser_postfix_expression): Call > set_c_expr_source_range before break in the __builtin_stdc_rotate_* > case. > > * gcc.dg/pr118376.c: New test. > > --- gcc/c/c-parser.cc.jj 2025-01-06 10:07:33.585493775 +0100 > +++ gcc/c/c-parser.cc 2025-01-09 16:12:07.761005082 +0100 > @@ -12906,6 +12906,7 @@ c_parser_postfix_expression (c_parser *p > expr.value = build2_loc (loc, COMPOUND_EXPR, > TREE_TYPE (expr.value), > instrument_expr, expr.value); > + set_c_expr_source_range (&expr, loc, close_paren_loc); > break; > } > tree barg1 = arg; > --- gcc/testsuite/gcc.dg/pr118376.c.jj 2025-01-09 16:26:19.621072359 > +0100 > +++ gcc/testsuite/gcc.dg/pr118376.c 2025-01-09 16:26:04.608283459 +0100 > @@ -0,0 +1,11 @@ > +/* PR c/118376 */ > +/* { dg-do compile } */ > +/* { dg-options "-Wsign-conversion" } */ > + > +unsigned x; > + > +void > +foo () > +{ > + __builtin_memset (&x, (long long) __builtin_stdc_rotate_right (x, 0), 1); > +} /* { dg-warning "conversion to 'int' from 'long long int' may change the > sign of the result" "" { target *-*-* } .-1 } */ > > Jakub > Marek