From patchwork Fri Feb 17 21:51:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 142016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EA4F01007D7 for ; Sat, 18 Feb 2012 08:51:36 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330120297; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Received-SPF:Received:Received:Received:Received:From:To:Subject: Date:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=M2gTt09Ntjci5lqLZNHp WqHRtbo=; b=D5WTbUTz1H1GzfATaCo+gHDZdTDdYPrKplrQRg7W5Hw7KjSrND9H e1INmFzs6RGgWPS2yCtIB3ozneq8hOxACiHamMUl3HpN51hNFpzgoLYgnx3PYeK+ oaje6UUXA53CX5xsfJRs0wofcatK+E21L15h2lgs2ipKNNRXNf6b9u4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received-SPF:Authentication-Results:Received:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qmJkkCwW3VggXZ5jUrQUC4jJli+YVLJjHgzDFL1RqcDSt2rWH/WqfuQpZHAlOx Jvi0nS0IpCm37mJvvI/sPYLclmgNVUg1RWi+gbI398ySJxvI21JEixzCZ/bVllZR 1YXrDZ5Nk4z1r3lanOPcong2XxOFNiGm7qlvtAofaiTIw=; Received: (qmail 6665 invoked by alias); 17 Feb 2012 21:51:31 -0000 Received: (qmail 6657 invoked by uid 22791); 17 Feb 2012 21:51:30 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 17 Feb 2012 21:51:15 +0000 Received: by pbcum15 with SMTP id um15so4071665pbc.20 for ; Fri, 17 Feb 2012 13:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of iant@google.com designates 10.68.190.8 as permitted sender) client-ip=10.68.190.8; Authentication-Results: mr.google.com; spf=pass (google.com: domain of iant@google.com designates 10.68.190.8 as permitted sender) smtp.mail=iant@google.com; dkim=pass header.i=iant@google.com Received: from mr.google.com ([10.68.190.8]) by 10.68.190.8 with SMTP id gm8mr27644698pbc.146.1329515475072 (num_hops = 1); Fri, 17 Feb 2012 13:51:15 -0800 (PST) Received: by 10.68.190.8 with SMTP id gm8mr22653218pbc.146.1329515475042; Fri, 17 Feb 2012 13:51:15 -0800 (PST) Received: by 10.68.190.8 with SMTP id gm8mr22653197pbc.146.1329515474971; Fri, 17 Feb 2012 13:51:14 -0800 (PST) Received: from coign.google.com ([2620:0:1000:2404:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id u9sm6128007pbe.36.2012.02.17.13.51.13 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Feb 2012 13:51:14 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't lower binary exprs with mismatched types Date: Fri, 17 Feb 2012 13:51:13 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk32iGnYATQrp2/EFPcJ+hbzQTxEwdXxNlPBcjTiyAeSKH2FZLp4JzrloUNqAnTM83zH2sEPKfFj5wkgNMJk3GY7P960Om59APAPdOEIE8L0x0CoGPoHKlzcBzbncY5H3oXh39qC0BFZXpFSS/dz3A7J/0aKmLVlSPgKpcFATomeQDlwvA= X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The Go frontend was accidentally lowering binary expressions with mismatched types. It would reject two integer constant expressions with mismatched types, but would then go on to try to see if the expressions had floating point constant values. Since all integer constants can be viewed as floating point constants in Go, this would let the binary expressions be lowered as a floating point expressions, despite the mismatched types. This patch fixes the problem. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 5c9dac6bacc3 go/expressions.cc --- a/go/expressions.cc Fri Feb 17 11:58:53 2012 -0800 +++ b/go/expressions.cc Fri Feb 17 13:38:46 2012 -0800 @@ -5564,6 +5564,7 @@ && op != OPERATOR_RSHIFT) { // May be a type error--let it be diagnosed later. + return this; } else if (is_comparison) { @@ -5667,6 +5668,7 @@ && op != OPERATOR_RSHIFT) { // May be a type error--let it be diagnosed later. + return this; } else if (is_comparison) { @@ -5750,6 +5752,7 @@ && left_type->base() != right_type->base()) { // May be a type error--let it be diagnosed later. + return this; } else if (op == OPERATOR_EQEQ || op == OPERATOR_NOTEQ) {