From: Hans Wennborg Date: Wed, 20 Mar 2013 07:34:27 +0000 (+0000) Subject: Fix redundant comparison in gcc::Common::ConstructJob. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3309229f77222970cce344eaa6908ad9320d2d82;p=clang Fix redundant comparison in gcc::Common::ConstructJob. We were checking "Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::x86_64", but the rhs should actually check for powerpc64. Found while experimenting with a potential new Clang warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177496 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9a6a1f2b41..2a07c90819 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3631,7 +3631,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA, // here. if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc) CmdArgs.push_back("-m32"); - else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::x86_64) + else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64) CmdArgs.push_back("-m64"); if (Output.isFilename()) { diff --git a/test/Driver/unknown-gcc-arch.c b/test/Driver/unknown-gcc-arch.c index 5e4746babd..dcd17d4f46 100644 --- a/test/Driver/unknown-gcc-arch.c +++ b/test/Driver/unknown-gcc-arch.c @@ -1,8 +1,32 @@ -// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### 2> %t.log -// RUN: grep '.*gcc.*"-m64"' %t.log -// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### -m32 2> %t.log -// RUN: grep '.*gcc.*"-m32"' %t.log -// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### 2> %t.log -// RUN: grep '.*gcc.*"-m32"' %t.log -// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### -m64 2> %t.log -// RUN: grep '.*gcc.*"-m64"' %t.log +// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=X86_64 %s +// X86_64: {{.*gcc.*-m64}} + +// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### -m32 2>&1 \ +// RUN: | FileCheck -check-prefix=X86_64-M32 %s +// X86_64-M32: {{.*gcc.*-m32}} + +// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=I386 %s +// I386: {{.*gcc.*-m32}} + +// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### -m64 2>&1 \ +// RUN: | FileCheck -check-prefix=I386-M64 %s +// I386-M64: {{.*gcc.*-m64}} + + +// RUN: %clang -target powerpc64-unknown-unknown -c -x assembler %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=PPC64 %s +// PPC64: {{.*gcc.*-m64}} + +// RUN: %clang -target powerpc64-unknown-unknown -c -x assembler %s -### -m32 2>&1 \ +// RUN: | FileCheck -check-prefix=PPC64-M32 %s +// PPC64-M32: {{.*gcc.*-m32}} + +// RUN: %clang -target powerpc-unknown-unknown -c -x assembler %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=PPC %s +// PPC: {{.*gcc.*-m32}} + +// RUN: %clang -target powerpc-unknown-unknown -c -x assembler %s -### -m64 2>&1 \ +// RUN: | FileCheck -check-prefix=PPC-M64 %s +// PPC-M64: {{.*gcc.*-m64}}