From patchwork Tue Mar 11 15:27:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 329133 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B36402C009A for ; Wed, 12 Mar 2014 02:28:30 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=tu8mKCv6k0NPi6C59rP+gBd5semFDTqAwBjiFDhMS8HpiW7H/cF9F diRPc2C4VlEC5+jeW7Wk/1vzDjviReYUk0qSgsJ1ytXaisVQEy9tMajjAFNghftR j7WnfujKOSfGyBmkh5QfxQyNU9wp9yqWigtQPJKzQbfj3+tZq8Whvg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=kfnXdVdGrtwz2uLoQjA/r8SWA9Q=; b=dJX398Iq+3uEodLr5xeF 3H5XH3BKMFqEA7a1EbKW6ylhtj8XoDZhR/UpD+dPPEW9UqopNZ1kmQA1O3yNUIqH 8mOJQ62STZmqxO/d3EwYU6EZpZ/H3ye4xjFHNky73xY3ovzB1OpObmR4SQC3WPf7 BMWuy5LrhHYTcad8dstXqLQ= Received: (qmail 25045 invoked by alias); 11 Mar 2014 15:28:20 -0000 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 Received: (qmail 25032 invoked by uid 89); 11 Mar 2014 15:28:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Tue, 11 Mar 2014 15:28:18 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3E6F97501A for ; Tue, 11 Mar 2014 15:28:15 +0000 (UTC) Date: Tue, 11 Mar 2014 16:27:01 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] More PTA carefulness Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 This adds two asserts that guards possible wrong-code issues in get_constraint_for_ptr_offset. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2014-03-11 Richard Biener * tree-ssa-structalias.c (get_constraint_for_ptr_offset): Add asserts to guard possible wrong-code bugs. Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 208479) +++ gcc/tree-ssa-structalias.c (working copy) @@ -3095,7 +3095,7 @@ get_constraint_for_ptr_offset (tree ptr, if (c.type == ADDRESSOF /* If this varinfo represents a full variable just use it. */ && curr->is_full_var) - c.offset = 0; + ; else if (c.type == ADDRESSOF /* If we do not know the offset add all subfields. */ && rhsoffset == UNKNOWN_OFFSET) @@ -3143,8 +3143,14 @@ get_constraint_for_ptr_offset (tree ptr, temp = vi_next (temp); } } + else if (c.type == SCALAR) + { + gcc_assert (c.offset == 0); + c.offset = rhsoffset; + } else - c.offset = rhsoffset; + /* We shouldn't get any DEREFs here. */ + gcc_unreachable (); (*results)[j] = c; }