Fix uninitialized exp.X_op in ARM assembler expression parsing
ARM assembler correctly initializes expression data before parsing to prevent potential errors.
A fix has been applied to the ARM assembler’s expression parsing logic to address an uninitialized exp.X_op field. The initialization of the expressionS structure is now performed before the first return in the my_get_expression function. This ensures that all fields within the expression structure are properly initialized, preventing potential errors or undefined behavior during the parsing of ARM assembly expressions.
In Details
The my_get_expression function in gas/config/tc-arm.c previously had the memset(ep, 0, sizeof(expressionS)) call after a conditional return. This commit moves the initialization to the beginning of the function, ensuring that ep->X_op and other fields are always initialized before being used, thus fixing a potential uninitialized variable issue.
- exp.X_op
- A field within the
expressionSstructure used by the GNU Assembler (GAS) to represent an operand in an assembly expression. - ARM assembler
- The GNU Assembler (GAS) configured to process ARM assembly language.
- expression parsing
- The process of interpreting and analyzing strings that represent mathematical or symbolic expressions in assembly code.