]> granicus.if.org Git - clang/commitdiff
Emit diagnostic for -munaligned-access on v6m
authorJonathan Roelofs <jonathan@codesourcery.com>
Tue, 7 Oct 2014 15:11:32 +0000 (15:11 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Tue, 7 Oct 2014 15:11:32 +0000 (15:11 +0000)
Patch by: Charlie Turner <charlie.turner@arm.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219211 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/arm-alignment.c

index c09d48906e59a766860f3aa3e96d7652dec5df72..bb9efaf14305f938af2f26f85579dfc3a8971a57 100644 (file)
@@ -823,8 +823,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
       if (A->getOption().matches(options::OPT_mno_unaligned_access))
         CmdArgs.push_back("-arm-strict-align");
       else {
-        if (getToolChain().getTriple().getSubArch() ==
-            llvm::Triple::SubArchType::ARMSubArch_v6m)
+        if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
           D.Diag(diag::err_target_unsupported_unaligned) << "v6m";
         CmdArgs.push_back("-arm-no-strict-align");
       }
index e7b7ac34874d3211bb18dab34e477ba3675a0d63..3fe595143f7d908c85b9c0930fb898ffe5b2e561 100644 (file)
 
 // CHECK-ALIGNED-ARM: "-backend-option" "-arm-strict-align"
 // CHECK-ALIGNED-AARCH64: "-backend-option" "-aarch64-strict-align"
+
+// Make sure that v6M cores always trigger the unsupported aligned accesses error
+// for all supported architecture triples.
+// RUN: not %clang -c -target thumbv6m-none-gnueabi -mcpu=cortex-m0 -munaligned-access %s 2>&1 | \
+// RUN:   FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
+// RUN: not %clang -c -target thumb-none-gnueabi -mcpu=cortex-m0 -munaligned-access %s 2>&1 | \
+// RUN:   FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
+
+// CHECK-UNALIGN-NOT-SUPPORTED: error: the v6m sub-architecture does not support unaligned accesses