From patchwork Tue Apr 9 19:27:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1082676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-499032-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RftIuUSz"; dkim-atps=neutral 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 44dy856mWjz9sRY for ; Wed, 10 Apr 2019 05:31:17 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=fnwZRCoEQqV8SqNd f9bq7K0mazF3hkO3QWQ631tT/IfF+/FiFnx2G+KsYaEXqj1ClPGPTCehhV8WxPzG 6qJbKIlbnuL6PR7q7uOSE/4aQduszFZLKIQGkAWtO0oQuu3HgZkjIPgCZjdQVQYU 7oid+XblR7SjVkLItpqasS091T4= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=2AdpOVrCzrovOx6rKa7xiy zbCu8=; b=RftIuUSzLfuWAGqvBWP4ztRTzb6zqix8tgQTw8MeBc/t0KZDJUa7uL qrPTLCkqHLA0ZPR1qTLFG74v1kbzqKh+EdXzmOn1NfZOynhgXTjL4IxsDAhXmhsN 55kE+M5aThYztcB2LlmmnXVI2My4fIuTdCo2lcmzo87XM+vOjw/+I= Received: (qmail 110236 invoked by alias); 9 Apr 2019 19:31:10 -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 110216 invoked by uid 89); 9 Apr 2019 19:31:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Envelope-From:sk:ebotcaz, H*F:U*ebotcazou, 270188, DECL_NAME X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Apr 2019 19:31:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id E583781398 for ; Tue, 9 Apr 2019 21:31:05 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kFGjLc_Swto5 for ; Tue, 9 Apr 2019 21:31:05 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id C23BF81397 for ; Tue, 9 Apr 2019 21:31:05 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix wrong translation of C++ virtual destructor Date: Tue, 09 Apr 2019 21:27:57 +0200 Message-ID: <8888127.YASx4lQ5Rx@polaris> MIME-Version: 1.0 This is a regression present on all active branches: -fdump-ada-spec no longer generates a declaration for the (implicit) deleting destructor in a class, which is problematic if it's virtual because it has a slot in the vtable. Tested on x86_64-suse-linux, applied on all active branches. 2019-04-09 Eric Botcazou c-family/ * c-ada-spec.c (print_destructor): Deal with deleting destructors. (dump_ada_declaration) : Likewise. Index: c-ada-spec.c =================================================================== --- c-ada-spec.c (revision 270188) +++ c-ada-spec.c (working copy) @@ -2676,6 +2676,8 @@ print_destructor (pretty_printer *buffer tree decl_name = DECL_NAME (TYPE_NAME (type)); pp_string (buffer, "Delete_"); + if (strncmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__dt_del", 8) == 0) + pp_string (buffer, "And_Free_"); pp_ada_tree_identifier (buffer, decl_name, t, false); } @@ -2946,9 +2948,10 @@ dump_ada_declaration (pretty_printer *bu if (DECL_ARTIFICIAL (t)) return 0; - /* Only consider constructors/destructors for complete objects. */ + /* Only consider complete constructors and deleting destructors. */ if (strncmp (IDENTIFIER_POINTER (decl_name), "__ct_comp", 9) != 0 - && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_comp", 9) != 0) + && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_comp", 9) != 0 + && strncmp (IDENTIFIER_POINTER (decl_name), "__dt_del", 8) != 0) return 0; }