From patchwork Sun Oct 5 03:51:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 396603 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 F1FF2140139 for ; Sun, 5 Oct 2014 13:51:28 +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=VOUaXX+LBiMh8PLvsSzFZ3TIw5SOx69B+yzVR14pN6+IFer8eYOJ4 sJsK56KFtFTGtXT6srm/xJ423E4eHwDVb3NZNZV710fgLB1dBc6Us4GsfYa7dEG4 9HCZuioUHPkYTPZQbrznURLyKVvL/FdN3icKpzBqE+b53/oxQc+HMY= 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=NxHr80AhEB+u1uWKINxZNc3kE/k=; b=AgaXhjoZxO+28YgnlEEa L6c1R+1ivetwtArz4EcwCOZbAum1ClTFG0NSaKbNluLsEG+sAEsotFbsJMrIt08C g+9YRZRVZamY/ymXhsvx85TZwnBUEWFidAOQSuoui+ZVGaPliDErLGJsrmpJ92u+ vphb/Qvny+v1OYy2Mnq+qXY= Received: (qmail 30898 invoked by alias); 5 Oct 2014 02:51: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 30874 invoked by uid 89); 5 Oct 2014 02:51:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 05 Oct 2014 02:51:16 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id ACCF85408FD; Sun, 5 Oct 2014 04:51:12 +0200 (CEST) Date: Sun, 5 Oct 2014 04:51:12 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: PR 62121 (Segmentation fault in ipa-devirt.c:997) Message-ID: <20141005025112.GC16241@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, this is 4.9 version of patch fixing ICE on ipa-devirt.c:997. The problem is that we get TYPE_SIZE NUll but code does not expect it. Honza PR ipa/62121 * ipa-devirt.c (restrict_to_inner_class): Do not ICE when type is unknown. * g++.dg/torture/pr62121.C: New testcase. Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 215893) +++ ipa-devirt.c (working copy) @@ -994,7 +994,8 @@ give_up: if ((TREE_CODE (type) != RECORD_TYPE || !TYPE_BINFO (type) || !polymorphic_type_binfo_p (TYPE_BINFO (type))) - && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST + && (!TYPE_SIZE (type) + || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST || (offset + tree_to_uhwi (TYPE_SIZE (expected_type)) <= tree_to_uhwi (TYPE_SIZE (type))))) return true; Index: testsuite/g++.dg/torture/pr62121.C =================================================================== --- testsuite/g++.dg/torture/pr62121.C (revision 0) +++ testsuite/g++.dg/torture/pr62121.C (revision 0) @@ -0,0 +1,12 @@ +// { dg-do compile } +class A +{ + virtual double operator()(); +}; +class B : A +{ +public: + double operator()(); +}; +extern B a[]; +int b = a[0]();