From patchwork Mon Apr 23 10:18:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 154384 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 75881B6FA3 for ; Mon, 23 Apr 2012 20:18:29 +1000 (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=1335781110; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=XIK/rqub4S4pSD1TEsz1 k4KWhJg=; b=SrPvNfrFv3BjpG57BLzO9cRT8DsJ0EvhXgHzD5zA0OOWOhiLnJNh vK2YvatrV0jWi/qGTdu4ZyJ6BrEXUh/GgYoMVzJ+Q7FN6S8eDqmBLSxIv+x1C0u8 RMZlIZ/KvOr0uXV/qNJ9AFO93oW0eLSP01ezQiamgxPPvHgiTtZLyNs= 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:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=RqAgpKpua1W14uaWS7IMdmefcOedRrNa9UF8HfDNDBwepxV1AlIzVuudBLaOv3 2F/XaM3HPTShfcbLZ3xDEmINF5GNxMZkhwFGnJ0Fr92IrafL43EdZHr/K5qm8nBE SaftOXSyfb6pYiRauBIHz/OTTeVnOxPTPrugrD+20egw0=; Received: (qmail 11572 invoked by alias); 23 Apr 2012 10:18:18 -0000 Received: (qmail 11546 invoked by uid 22791); 23 Apr 2012 10:18:16 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Apr 2012 10:18:03 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id B144394A6A for ; Mon, 23 Apr 2012 12:18:01 +0200 (CEST) Date: Mon, 23 Apr 2012 12:18:01 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR53060 Message-ID: MIME-Version: 1.0 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 This fixes a typo. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2012-04-23 Richard Guenther PR c/53060 * c-typeck.c (build_binary_op): Fix typo. * gcc.dg/pr53060.c: New testcase. Index: gcc/c-typeck.c =================================================================== --- gcc/c-typeck.c (revision 186623) +++ gcc/c-typeck.c (working copy) @@ -9733,7 +9733,7 @@ build_binary_op (location_t location, en sc = convert (TREE_TYPE (type0), sc); op1 = build_vector_from_val (type0, sc); if (!maybe_const) - op0 = c_wrap_maybe_const (op1, true); + op1 = c_wrap_maybe_const (op1, true); orig_type1 = type1 = TREE_TYPE (op1); code1 = TREE_CODE (type1); converted = 1; Index: gcc/testsuite/gcc.dg/pr53060.c =================================================================== --- gcc/testsuite/gcc.dg/pr53060.c (revision 0) +++ gcc/testsuite/gcc.dg/pr53060.c (revision 0) @@ -0,0 +1,24 @@ +/* { dg-do run } */ + +extern void abort (void); + +int f(void) { return 2; } +unsigned int g(void) { return 5; } +unsigned int h = 1; + +typedef unsigned int vec __attribute__((vector_size(16))); + +vec i = { 1, 2, 3, 4}; + +vec fv1(void) { return i + (h ? f() : g()); } +vec fv2(void) { return (h ? f() : g()) + i; } + +int main() +{ + vec i, j; + j = fv1(); + if (j[0] != 3) abort(); + i = fv2(); + if (i[0] != 3) abort(); + return 0; +}