From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E3AA5385841E for ; Wed, 26 Oct 2022 09:04:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3AA5385841E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666775065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=rrYlRCjZh3aPbA80VjBC7HKw0x9cheBvauhsQuMRAM8=; b=O5pcTfZg0w5Kufm2RQW63vNDhnry6Tc0bWTrkGles8pvlyF1U5MIlz1rzyjzXdTLmbS2qW Hmws+CEO6mpj/F7JsRDpFf2361Y3ZqRnA2BPqfAgCAoCTGAkXoPla+dYKXKDb5xkbQgaGf t8soqkQChIvYPvtcqcpxb7gJD9RgTB4= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-22-qIaJ5qG5NkGuH2CWmEX_tA-1; Wed, 26 Oct 2022 05:04:17 -0400 X-MC-Unique: qIaJ5qG5NkGuH2CWmEX_tA-1 Received: by mail-qv1-f72.google.com with SMTP id g12-20020a0cfdcc000000b004ad431ceee0so8504570qvs.7 for ; Wed, 26 Oct 2022 02:04:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rrYlRCjZh3aPbA80VjBC7HKw0x9cheBvauhsQuMRAM8=; b=POjeTh9KEMvLQzjMlfyIoYLQREXnimJv8KlLdv33Kejz/H22Opb4LKq5K9+7XNxTkB BJ83+Mra70nvhdXza3KD7hot14VEWUF224PrSXO87T9Ph5blw2GiOpEZj6ao5sqUIPyT q2ye5PHJOCCeupZ4cwiQ8ln6f+sYQgEFW7vDcFfo5XFSGfiF2DAs6YRTu2HpjmtAWqAg 0gW74vu9irbubTE1y1qj1AylN/9hH5IzvHi0Rd/LEGDFjQqwr7wNdk9D3EieYEdFOJ9w 18n4FHMnGX9DGkVGAcJ26QHBLXRA5bqlpbNAyzufssL+m6CTgvj/642vsvzErg3kGVgs qyyg== X-Gm-Message-State: ACrzQf3Gis8ZEe/+pJhUyfS/AugggZy5TWTHUbyf48oWHyz9wgCU5x/M UPwjOJzCXVu3Ewqp2u4NTzenzU7heZjjZHHNSByNvineYRSGS5ggcemupAnfe4RIvIafHA16hZg +LrviLaRW0ZzylerIdEZZONczEm4WaBajcaLl05MeJ3rwPRwKoQszG4GF5Fvyku3zZsOK X-Received: by 2002:a37:9a97:0:b0:6f8:a151:6af6 with SMTP id c145-20020a379a97000000b006f8a1516af6mr2938299qke.551.1666775057057; Wed, 26 Oct 2022 02:04:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wP//ekuSPQLVLaBmagUM8Y3imWbaphfxa7Vs3a2CRphPJcTuAH2CU1CJK19gCEUCb3ppxoA== X-Received: by 2002:a37:9a97:0:b0:6f8:a151:6af6 with SMTP id c145-20020a379a97000000b006f8a1516af6mr2938285qke.551.1666775056752; Wed, 26 Oct 2022 02:04:16 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id g21-20020a05620a40d500b006ee8874f5fasm3735038qko.53.2022.10.26.02.04.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 02:04:16 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id BCEF3581C59; Wed, 26 Oct 2022 11:04:14 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Don't crash when looking at corpus-less translation units Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Wed, 26 Oct 2022 11:04:14 +0200 Message-ID: <874jvrot0x.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 Content-Type: text/plain X-Spam-Status: No, score=-11.9 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_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello, Back in the early days, there was the possibility to have an ABIXML output that was just a translation unit. There was no XML corpus element holding the abi-instr element. We still need to support this going forward. While looking at something else, I stumbled across spots in the source code that would crash upon encountering such corpus-less ABIXML inputs. Fixed thus. * src/abg-ir.cc ({decl,type}_topo_comp::operator()): Support types that inherits from an empty corpus. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index b914faaa..5193934a 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -3353,8 +3353,9 @@ struct decl_topo_comp // If both decls come from an abixml file, keep the order they // have from that abixml file. - if (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN - && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN) + if ((!f->get_corpus() && !s->get_corpus()) + || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN + && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN)) return compare_using_locations(f, s); // If a decl has artificial location, then use that one over the @@ -3451,8 +3452,9 @@ struct type_topo_comp { // If both decls come from an abixml file, keep the order they // have from that abixml file. - if (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN - && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN) + if ((!f->get_corpus() && !s->get_corpus()) + || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN + && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN)) return compare_using_locations(is_decl(f), is_decl(s)); bool f_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(f); -- 2.38.0 -- Dodji