On Wed, Jan 07, 2026 at 03:52:33PM -0800, Jerry D wrote:
>    /* Build the namelist object name.  */
> -  if (sym && !sym->attr.use_only && sym->attr.use_rename
> -      && sym->ns->use_stmts->rename)
> +  if (sym && sym->attr.use_rename && sym->ns->use_stmts->rename
> +      && sym->ns->use_stmts->rename->local_name
> +      && sym->ns->use_stmts->rename->local_name[0]
> +      && strcmp(sym->ns->use_stmts->rename->use_name, var_name) == 0)
>      string = gfc_build_cstring_const 
> (sym->ns->use_stmts->rename->local_name);

This breaks on FreeBSD.  sym->ns->use_stmts->rename->local_name
is not a pointer.  local_name is a component of a gfc_use_rename
struct with a fixed size.  The strlen() I had in the code was
correct.


typedef struct gfc_use_rename
{
  char local_name[GFC_MAX_SYMBOL_LEN + 1], use_name[GFC_MAX_SYMBOL_LEN + 1];
  struct gfc_use_rename *next;
  int found;
  gfc_intrinsic_op op;
  locus where;
}
gfc_use_rename;


This combination

gfortran.h:#define gfc_get_use_rename() XCNEW (gfc_use_rename);
./include/libiberty.h:#define XCNEW(T)          ((T *) xcalloc (1, sizeof (T)))

should give a NULL terminated string when sym->...->rename is
alocated, and that string will have a zero length of 0 if it
is not set.

-- 
Steve

Reply via email to