On Wed, Aug 07, 2024 at 11:03:18AM +0200, Richard Biener wrote: > > Richi mentioned on IRC that the non-cleaned up names might make things > > harder to feed stuff back to the GIMPLE FE, but if so, I think it should be > > the dumping for GIMPLE FE purposes that cleans those up (but at that point > > it should also verify if some such cleaned up names don't collide with > > others and somehow deal with those). > > My plan was to accept an additional character in identifiers as > extension with -fgimple and use that. I think we already accept dollars > but dots are of course problematic and cannot be used. Replacing > unwanted chars with $ and pre-existing $ with $$ might work. There's > not many (ASCII) characters available, @ might be.
Some kind of mangling... ;) > > --- gcc/gimplify.cc.jj 2024-08-05 13:04:53.903116091 +0200 > > +++ gcc/gimplify.cc 2024-08-06 15:27:40.404865291 +0200 > > @@ -5599,6 +5599,18 @@ gimplify_init_constructor (tree *expr_p, > > > > DECL_INITIAL (object) = ctor; > > TREE_STATIC (object) = 1; > > + if (DECL_NAME (object) && DECL_NAMELESS (object)) > > + { > > + const char *name = get_name (object); > > + char *sname = ASTRDUP (name); > > + clean_symbol_name (sname); > > + /* If there are any undesirable characters in DECL_NAMELESS > > + name, just fall back to C.nnn name, we must ensure e.g. > > + SRA created names with DECL_UIDs don't make it into > > + assembly. */ > > + if (strcmp (name, sname)) > > + DECL_NAME (object) = NULL_TREE; > > + } > > Did you actually run into such a case? No, but I haven't collected statistics about that (so didn't add some fprintf there to log if it happened). > I'd expect > gimplify_init_constructor only happening on the original GENERIC IL. In theory one can construct INIT_EXPR and gimplify it in later passes as well. But it is unlikely, sure. > In any case how about the simpler > > if (!DECL_NAME (object) || DECL_NAMELESS (object)) > DECL_NAME (object) = create_tmp_var_name ("C"); > > ? This is what I had in my first version, but I was worried too many things would be DECL_NAMELESS during gimplification. I think I'll do another bootstrap/regtest with statistics gathering to see what is worth. > Otherwise looks OK to me. I guess this should get quite some > soaking time before backporting (if that was intended). Definitely. At least two months I'd say. Jakub