From patchwork Wed Sep 8 14:28:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 44912 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B5C8386197E for ; Wed, 8 Sep 2021 14:28:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B5C8386197E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631111337; bh=Ll0kBtNs0qntLBgBN4vBMGnzLopOAreJQF3LBXOmMxE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=hO1O1JsbLTiilx3pk43Brmv/lvOE6iwxIAswRzmNSUVFXlGB5WNuZLDNPO9Fkq1wS 0cpRLZgBjnblNkKYoAd+IQAcwDvqeTf4lfaXhD+7n8F+BqoEBnCg/mtkuEvqpw1LFS iXPK8tGP2OHKKe9qVdbi/Ed/scmJr5/08Vf453pc= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 5528E385842C for ; Wed, 8 Sep 2021 14:28:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5528E385842C Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-508-3RUgV6qvNBiuuSw6PUincQ-1; Wed, 08 Sep 2021 10:28:52 -0400 X-MC-Unique: 3RUgV6qvNBiuuSw6PUincQ-1 Received: by mail-wr1-f70.google.com with SMTP id u2-20020adfdd42000000b001579f5d6779so560966wrm.8 for ; Wed, 08 Sep 2021 07:28:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=Ll0kBtNs0qntLBgBN4vBMGnzLopOAreJQF3LBXOmMxE=; b=g3V/D69YLJzqWZb9QUnvkTnHXxxcBznHb5lkZ+6liJ6x3/5X5TBdf30yGGFPSHWLOZ W+DpGYimvVvVnqWw5N3l8Z4Tfd6/QodGBW6rZWbjydmVqAQTyF/Ixq0NE638xz3SHU1h 4JNboPFVPK2suRs/lUq7JqqayCoW65jb8MG2MDMuAp/szbRRTVi2f9uCFpmJcQt+baZY /F4n5ex7Y6qCx1mPHCqSd7JpcWv12YpYmxQOApxbvua1q11nqUXOE71GsebTGC0wTQNQ uxKW0PfTVu9MlJeSpYkC4/jgVhdoIc1xJJLfPc+5RAyUB/Yy0Oh6OBaklIQs2yQ2bMXv hYwg== X-Gm-Message-State: AOAM5318kEiXz+r9LW5X8Regp9NggEjZuiGpuikfGq8xE24p0sHUSlh9 D01rj3cwWYo+yv7EP0ah4AFsWMPwP96v6ljGsTgV3H4uSDtuak2Uk2YLIh9etFBnzF7yAWm9X/w SJwkF3hpcoChAMRCYhJu+AJO6sojext9jQDRUsRNiIUsYJ1VdEtfbqLmfAjJiU6NnVXYV X-Received: by 2002:adf:e0cd:: with SMTP id m13mr4443391wri.137.1631111330318; Wed, 08 Sep 2021 07:28:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxThnhDDVNNUAFfkqrfRq/rBV09j0CV1AktJR+vzUwL4fT/YLD/TAAcm1ugc2gFrIP98o0a/w== X-Received: by 2002:adf:e0cd:: with SMTP id m13mr4443349wri.137.1631111329847; Wed, 08 Sep 2021 07:28:49 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id t18sm1660674wrp.97.2021.09.08.07.28.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 07:28:49 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 358F058000E; Wed, 8 Sep 2021 16:28:49 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] RHBZ1951496 - ir: Acknowledge that "void type" is not canonicalized Organization: Red Hat / France X-Operating-System: Fedora 36 X-URL: http://www.redhat.com Date: Wed, 08 Sep 2021 16:28:49 +0200 Message-ID: <87y287dtum.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, In the libabigail type system, the void type is a synthetic type and is thus not canonicalized. We forgot to mention this "void type" to hash_as_canonical_type_or_constant as being one of the types that are allowed to be non canonicalized in the system. This omission violates an assert in that function. The patch introduces a new is_allowed_non_canonicalized_type subroutine that defines the types that are allowed to be non canonicalized in the system and make it recognize "void type" as such. hash_as_canonical_type_or_constant uses the new is_allowed_non_canonicalized_type. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1951496 * src/abg-ir.cc (is_allowed_non_canonicalized_type): Define new static function. (hash_as_canonical_type_or_constant): Use it. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 3ce49e76..6ce614a5 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -24932,6 +24932,25 @@ size_t hash_type_or_decl(const type_or_decl_base_sptr& tod) {return hash_type_or_decl(tod.get());} +/// Test if a given type is allowed to be non canonicalized +/// +/// This is a subroutine of hash_as_canonical_type_or_constant. +/// +/// For now, the only types allowed to be non canonicalized in the +/// system are decl-only class/union and the void type. +/// +/// @return true iff @p t is a one of the only types allowed to be +/// non-canonicalized in the system. +static bool +is_allowed_non_canonicalized_type(const type_base *t) +{ + if (!t) + return true; + + const environment* env = t->get_environment(); + return is_declaration_only_class_or_union_type(t) || env->is_void_type(t); +} + /// Hash a type by either returning the pointer value of its canonical /// type or by returning a constant if the type doesn't have a /// canonical type. @@ -24971,10 +24990,10 @@ hash_as_canonical_type_or_constant(const type_base *t) return reinterpret_cast(canonical_type); // If we reached this point, it means we are seeing a - // non-canonicalized type. It must be a decl-only class or a - // typedef type, otherwise it means that for some weird reason, the - // type hasn't been canonicalized. It should be! - ABG_ASSERT(is_declaration_only_class_or_union_type(t)); + // non-canonicalized type. It must be a decl-only class or a void + // type, otherwise it means that for some weird reason, the type + // hasn't been canonicalized. It should be! + ABG_ASSERT(is_allowed_non_canonicalized_type(t)); return 0xDEADBABE; }