Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752870AbbBXPZi (ORCPT ); Tue, 24 Feb 2015 10:25:38 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:39658 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbbBXPZf (ORCPT ); Tue, 24 Feb 2015 10:25:35 -0500 From: Daniel Sanders CC: Toma Tabacu , Daniel Sanders , Ralf Baechle , Andreas Herrmann , David Daney , Manuel Lauss , , Subject: [PATCH v2 2/4] MIPS: LLVMLinux: Fix a 'cast to type not present in union' error. Date: Tue, 24 Feb 2015 15:25:09 +0000 Message-ID: <1424791511-11407-3-git-send-email-daniel.sanders@imgtec.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1424791511-11407-1-git-send-email-daniel.sanders@imgtec.com> References: <1424791511-11407-1-git-send-email-daniel.sanders@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.14.177] To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1846 Lines: 53 From: Toma Tabacu Remove a cast to the 'mips16e_instruction' union inside an if condition and instead do an assignment to a local 'union mips16e_instruction' variable's 'full' member before the if statement and use this variable in the if condition. This is the error message reported by clang: arch/mips/kernel/branch.c:38:8: error: cast to union type from type 'unsigned short' not present in union if (((union mips16e_instruction)inst).ri.opcode ^ ~~~~ The changed code can be compiled successfully by both gcc and clang. Signed-off-by: Toma Tabacu Signed-off-by: Daniel Sanders Cc: Ralf Baechle Cc: Andreas Herrmann Cc: David Daney Cc: Manuel Lauss Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org --- v2 refreshes the patch. arch/mips/kernel/branch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index c2e0f45..c0c5e59 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c @@ -36,8 +36,10 @@ int __isa_exception_epc(struct pt_regs *regs) return epc; } if (cpu_has_mips16) { - if (((union mips16e_instruction)inst).ri.opcode - == MIPS16e_jal_op) + union mips16e_instruction inst_mips16e; + + inst_mips16e.full = inst; + if (inst_mips16e.ri.opcode == MIPS16e_jal_op) epc += 4; else epc += 2; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/