[PATCH] [ARM] Handle conflicts between -mfpu and -mfloat-abi options

Asiri Rathnayake asiri.rathnayake at arm.com
Thu Sep 25 11:18:00 PDT 2014


Hi Jon,

> +  // Some -mfpu=... options are incompatible with some mfloat-abi=... options
> +  if (Arg *B = Args.getLastArg(options::OPT_mfpu_EQ)) {
> +    StringRef FPU = B->getValue();
> +    if (FPU == "none") {
> +      // Signal incompatible -mfloat-abi=... options
> +      if (FloatABI == "hard")
> +        D.Diag(diag::warn_drv_implied_soft_float_conflict)
> +          << B->getAsString(Args) << A->getAsString(Args);
> +      else if (FloatABI == "softfp")
> +        D.Diag(diag::warn_drv_implied_soft_float_assumed)
> +          << B->getAsString(Args) << A->getAsString(Args);
> 
> 
> It might be that I'm not seeing quite enough context here without applying the 
> patch, but how do you prevent dereferencing nullptr in A when there's neither 
> OPT_msoft_float, OPT_mhard_float, nor OPT_mfloat_abi_EQ?

FloatABI would only be set if A is not null at this point. Although, I could include A in the if condition to make this code less brittle. But it would be redundant as it stands.

I'm thinking of leaving the code as it is. In case if a future change means FloatABI could be set at this point without A being set, the tests would crash. WDYT?

Thank you for the catch!

--Asiri

> 
> 
> Cheers,
> 
> Jon

http://reviews.llvm.org/D5460






More information about the cfe-commits mailing list