Hi, Nick Clifton wrote: > Hi Julian, > >> I think it'd probably work, but maybe it'd be better to add a >> bounds-checked/non-bounds-checked argument to parse_immediate() or >> write a non-bounds-checking version of the function instead? > > I think that this would be the best solution. It makes the meaning of > the arguments passed to parse_immediate more obvious. [...] > >>> I am a little bit confused here. How is ((x >> 16) >> 16) different >>> from (x >> 32) ? If not, then why express it that way ? >> >> If sizeof(exp.X_add_number)==4 (i.e. on 32-bit hosts), then I think >> that writing (x >> 32) is invalid C (which isn't very nice, even if >> that code would never be executed). > [...] Or just have the comment in the code. Here's a (rather belated) new version of the patch which adds bounds-checking and non-bounds-checking forms to parse_immediate, avoiding the previous nastiness with INT_MIN/INT_MAX. Tested with "make check" on x86 and x86_64 with cross to arm-none-eabi. OK? (for mainline? CSL branch?) Cheers, Julian ChangeLog gas/ * config/tc-arm.c (parse_immediate): Add BOUNDED parameter, rename to... (parse_immediate_maybe_bounded): This. Only bounds-check if BOUNDED is true. (parse_immediate_bounded): New function, with same arguments and semantics as previous parse_immediate. (parse_immediate_unbounded): New function. Parse an unbounded integer (with sizeof (exp.X_add_number)). (parse_big_immediate): Allow for 64-bit exp.X_add_number when parsing 64-bit immediates. (parse_address_main): Use parse_immediate_bounded not parse_immediate. (parse_ror): Likewise. (parse_operands): Likewise. For Neon immediates, use parse_immediate_unbounded. Add new local po_imm_unb_or_fail macro.