On Thu, Sep 04, 2025 at 05:50:45PM -0700, Andrew Pinski wrote:
> On Thu, Sep 4, 2025 at 5:27 PM Kees Cook <[email protected]> wrote:
> > +
> > +  /* Unknown builtin type - this should never happen in a well-formed C 
> > program.  */
> > +  debug_tree (type);
> > +  internal_error ("mangle: Unknown builtin type in function %qD - please 
> > report this as a bug",
> > +                  current_function_context);
> 
> This should NOT be internal_error but rather sorry.

Ah, heh. I switched to internal_error because you'd suggested it in
the last version. Maybe I misunderstood where I should be using sorry vs
internal_error.

> > +       if (!name && !TYPE_NAME (type))
> > +         {
> > +           static char anon_name[128];
> 
> I am not a fan of a static variable here. Why not just a stack variable?

Oh, whoops. I will fix that.

> > +         {
> > +           /* Always show diagnostic information for missing struct names. 
> >  */
> > +           debug_tree (type);
> > +           internal_error ("mangle: Missing case in struct name extraction 
> > - please report this as a bug");
> 
> Again sorry rather than internal_error.
> 
> I still think it would be better if the hashing and mangling be one
> step rather than 2 separate steps.
> Especially since this is only used for the hashing and will most
> likely only used there ever.

In this version the hashing happens immediately. No full string is built
unless the dumpfile is enabled.

-Kees

-- 
Kees Cook

Reply via email to