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

Jonathan Roelofs jonathan at codesourcery.com
Thu Sep 25 10:41:02 PDT 2014


-  if (Arg *A = Args.getLastArg(options::OPT_msoft_float,
-                               options::OPT_mhard_float,
-                               options::OPT_mfloat_abi_EQ)) {
+  const Arg *A = Args.getLastArg(options::OPT_msoft_float,
+                                 options::OPT_mhard_float,
+                                 options::OPT_mfloat_abi_EQ);
+  if (A) {
      if (A->getOption().matches(options::OPT_msoft_float))
        FloatABI = "soft";
      else if (A->getOption().matches(options::OPT_mhard_float))
@@ -591,6 +601,31 @@
      }
    }

+  // 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?


Cheers,

Jon

On 9/25/14 8:31 AM, Asiri Rathnayake wrote:
> Hi Renato,
>
> I've updated the patch with the [-mfloat-abi=soft -mfpu=<fpu>] warning removed and strengthening the test cases.
>
> Will commit if there's no objection.
>
> Best,
>
> --Asiri
>
> http://reviews.llvm.org/D5460
>
> Files:
>    include/clang/Basic/DiagnosticDriverKinds.td
>    lib/Driver/ToolChains.cpp
>    lib/Driver/Tools.cpp
>    lib/Driver/Tools.h
>    test/Driver/arm-mfpu.c
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the cfe-commits mailing list