mips gas: expression initialisation
Maciej W. Rozycki
macro@orcam.me.uk
Tue Sep 16 12:18:12 GMT 2025
On Tue, 16 Sep 2025, Alan Modra wrote:
> There is a make_expr_symbol in append_insn, which gets called from
> macro_build, which is all over the place. Many of these set up an
> expression without initialising all fields. Now the uninitialised
> fields should not be accessed in a properly functioning assembler,
> but I'm inclined to think anything copied ought to be initialised.
Thank you for looking into it. I like your change except for the bits
around `micromips_label_expr', which I find messy as they stand and at
best no better with your modifications.
I think this part ought to be a separate patch as the first step:
static expressionS
mips_label_expr (offsetT offset)
{
return (expressionS) {
.X_op = O_constant,
.X_add_number = offset
};
}
static expressionS
micromips_label_expr (void)
{
return (expressionS) {
.X_op = O_symbol,
.X_add_symbol = symbol_find_or_make (micromips_label_name ())
};
}
(unsure about correct indentation here), and then we'll get rid of all the
mess and let the compiler figure out whether inlining the initialiser will
be cheaper in terms of the optimisation level chosen or not. WDYT?
Maciej
More information about the Binutils
mailing list