From patchwork Mon Mar 16 19:35:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 450726 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 4E046140142 for ; Tue, 17 Mar 2015 06:35:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=iYpV6OU3; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=sMzm7/YOyVnIowOhFH dxzJ09aBgZlJt2I4GoeAKOK1PETWxzNlIdfdHUlJE3f9ahZLl2XX6RnKHvlM+tV0 lKor6mBxjLYNcHH8gBXotFQ5HW+1aLK9WXbYJwDYCwWpuBNUdp0K/77NLuqOplUd wTh+Mi1FXVISFdydUm2b/HqNw= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=EX/U4u82RBaC75qSwRYTUSx3 Q3A=; b=iYpV6OU37pU852YS7oDmHlVDrw4KGUd4NLD8z6HXyA3RVEVEJgZUxGvf mdM3bl0f7NsFRAWPC8WSydZkIAyMqiuki2JVm56zVnRqxTGmLgeYwdZF0tpTGH2b F/+pSPy9i8yUN4IKdKZI9UH64UAiJw0KZvfwd5OzcdXw+olYM7w= Received: (qmail 5300 invoked by alias); 16 Mar 2015 19:35:08 -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 5291 invoked by uid 89); 16 Mar 2015 19:35:07 -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, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 16 Mar 2015 19:35:06 +0000 Received: by wibdy8 with SMTP id dy8so46138595wib.0 for ; Mon, 16 Mar 2015 12:35:03 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.206.101 with SMTP id ln5mr58888973wic.55.1426534503381; Mon, 16 Mar 2015 12:35:03 -0700 (PDT) Received: by 10.27.172.143 with HTTP; Mon, 16 Mar 2015 12:35:03 -0700 (PDT) In-Reply-To: References: <55071BD5.9020909@redhat.com> Date: Mon, 16 Mar 2015 20:35:03 +0100 Message-ID: Subject: Re: [patch c++]: Fix for PR/65390 From: Kai Tietz To: Jason Merrill Cc: GCC Patches X-IsSubscribed: yes 2015-03-16 20:22 GMT+01:00 Kai Tietz : > 2015-03-16 19:07 GMT+01:00 Jason Merrill : >> If there is an alignment mismatch without user intervention, there is a >> problem, we can't just ignore it. >> >> Where we run into trouble is with array types where the version built >> earlier has not been laid out yet but the new one has been. I've been >> trying to deal with that by making sure that we lay out the original type as >> well, but obviously that isn't working for this case. Why not? > > Well, TYPE_ALIGN (t) is set to 32, and it differs to TYPE_ALIGN > (result) (value 8), and TYPE_USER_ALIGN isn't set. > >> I suppose we could avoid checking TYPE_ALIGN if neither TYPE_USER_ALIGN nor >> TYPE_SIZE are set on 't', but checking TYPE_USER_ALIGN isn't enough. > > For t TYPE_SIZE is set, but it isn't a constant (as it is an variably > modified type). So we could add here additional check if TYPE_SIZE is > a integer-constant? > > Something like this condition you mean? So tested following patch checking for existing TYPE_SIZE, plus if it is a constant-value. Index: tree.c =================================================================== --- tree.c (Revision 221277) +++ tree.c (Arbeitskopie) @@ -1356,7 +1356,9 @@ strip_typedefs (tree t) if (!result) result = TYPE_MAIN_VARIANT (t); if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result) - || TYPE_ALIGN (t) != TYPE_ALIGN (result)) + || ((TYPE_USER_ALIGN (t) + || (TYPE_SIZE (t) && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST)) + && TYPE_ALIGN (t) != TYPE_ALIGN (result))) { gcc_assert (TYPE_USER_ALIGN (t)); if (TYPE_ALIGN (t) == TYPE_ALIGN (result))