From patchwork Fri Feb 10 12:31:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 64665 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 A0CD1385840D for ; Fri, 10 Feb 2023 12:34:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0CD1385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676032479; bh=ndtx81X9m/JHa1d1jkz1ueg5KE4PfAjY5TcHPaYFM6o=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=M+cbv8WZCfqnRC6epy9J7KAOfpVKRzWshZ5KHZMd+HfGVGFPMM/GwUZgbxcB5d9A6 ELgK5wGEQG4FJ6cJdEeLT9ei3kAAoIVu+Fl8JskptMWYmWdI03rxVmWbPoEpt/L9HP guGtMY9S/8H9JqvTcCae77BnxhCYycIzxMGxs5S0= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 45B903858C5F for ; Fri, 10 Feb 2023 12:34:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45B903858C5F Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-619-_Q49B7sAPea8HuICJvtE1g-1; Fri, 10 Feb 2023 07:34:28 -0500 X-MC-Unique: _Q49B7sAPea8HuICJvtE1g-1 Received: by mail-qt1-f198.google.com with SMTP id j26-20020ac84c9a000000b003b9b7c60108so2977545qtv.16 for ; Fri, 10 Feb 2023 04:34:28 -0800 (PST) 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=ndtx81X9m/JHa1d1jkz1ueg5KE4PfAjY5TcHPaYFM6o=; b=KJzGMlygZB0tg/GLkUXEwYCjAp+MdkyL+f6vyZfNw70ARGYJGDuP/Sfo8sv6tEzm2a B4AlwNv5PR1c5614HZQdXGVZL8s6fWoDZo6PVGpmLgta+dmKK3CBbxPA1gSxpTdJ38fa SPrBCjP2FKyta5q+xWN+wzhBJUIQPLqYV+74pS7MeBCMW1GvLvWsvNkF3poSrhiRLe75 sPN63IH8o4X7MkBEqh2zDpvY/xXreUM44ydtH2CbSir3IfLZfbinQj/+ebmhgg+wQLe2 oSCzuKDrmGrB3T8KcdrpamuiF3L8QkQMQ+kXaU58Y23R9lumnjjGbH/f5yPcWtatnR/Q 1dlQ== X-Gm-Message-State: AO0yUKVEiLXyjmiGiXzwxqXqa4zknApxhch7bEUE0135m9Vq2yAJEXTI z5ltxh6mjDQjZCexqd8gZ7GMLU/+uT0Q4lR8Ftwz19A1JlLLxNoYZpoYYDEvYkunZSFzve8aEm+ 1/6yPngZACBeqVLJCSrN2G1tWcNFkPVGeXOvxSXW53inP6/CIvZwN8DUpVLmuz3rLhJrvwXPjvQ == X-Received: by 2002:ac8:5705:0:b0:3b8:3bd9:9c19 with SMTP id 5-20020ac85705000000b003b83bd99c19mr25989001qtw.54.1676032467168; Fri, 10 Feb 2023 04:34:27 -0800 (PST) X-Google-Smtp-Source: AK7set+WHPH6HbNy0fSU28R/u+caxlArjkYZDMBpDC5zXQdBDBq9h11MrxQGZym/oh69DgA+LNVpJw== X-Received: by 2002:ac8:5705:0:b0:3b8:3bd9:9c19 with SMTP id 5-20020ac85705000000b003b83bd99c19mr25988882qtw.54.1676032465996; Fri, 10 Feb 2023 04:34:25 -0800 (PST) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id e7-20020a378207000000b0071a49ac0e05sm3345312qkd.111.2023.02.10.04.34.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 04:34:25 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id EC77E581D06; Fri, 10 Feb 2023 13:31:41 +0100 (CET) To: libabigail@sourceware.org Subject: [PATCH, applied] PR30048 - wrong pretty representation of qualified pointers Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Fri, 10 Feb 2023 13:31:41 +0100 Message-ID: <87sffdn1le.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=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, LOTS_OF_MONEY, 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 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, A qualified type is textually represented as the following: were "qualifier" is the qualifier carried by the qualified type and "underlying-type" is the type being qualified. In this case, the qualifier prefixes the textual representation of the qualified type. This is true if the underlying type of the qualified type is a non-const, non-reference type. For instance: const int; But when the underlying type is a pointer, then the qualified type is represented as: int* const; In that later case, the qualifier comes /after/ the textual representation of the underlying type. Now suppose the underlying type is itself a qualified type. In that case, for a non-const underlying type, we'd have, e.g: const volatile int; where the qualifier precedes the qualified type (which is itself a qualified type) /IF/ the ultimate underlying type (a.k.a the leaf underlying type) is itself a non-const, non-reference type. But if the ultimate underlying type is a pointer, a qualified type with an underlying qualified type would be textually represented as, e.g: int* const volatile; In other words, if the leaf type is a pointer, the qualifier suffixes the textual representation the underlying qualified type. Libabigail is failing to apply this later rule. As the type name is used as a key to cache IR nodes of DIEs (among other things), getting it wrong can lead to a bumpy ride down the road. Fixed thus. * src/abg-dwarf-reader.cc (die_is_pointer_array_or_reference_type): Rename die_is_pointer_or_reference_type into this. This new name reflects more what the function does as it tests if a DIE is for pointer, an array or a reference. (pointer_or_qual_die_of_anonymous_class_type): Adjust to use the newly (and better) named die_is_pointer_array_or_reference_type. (die_is_pointer_or_reference_type): Make this really test if a DIE is for a pointer or a reference. Now the name matches what the function does. (die_peel_qualified): Define new function. (die_qualified_type_name): When a qualified name Q has another qualified name as its underlying type, it's important to know if the leaf type is a pointer type or not to know how to construct the name of Q. This change now peels the potential qualifiers from the underlying type of the qualified type to see if the leaf type is a pointer or not. * src/abg-ir.cc (get_name_of_qualified_type): Likewise. Also, the name of array types doesn't follow the same rule as for pointers and references. * tests/data/test-abidiff-exit/PR30048-test-report-0.txt: Add new reference test output. * tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt: Likewise. * tests/data/test-abidiff-exit/PR30048-test-v{0,1}.c: Add source code of binary input data. * tests/data/test-abidiff-exit/PR30048-test-2-v{0,1}.cc: Likewise. * tests/data/test-abidiff-exit/PR30048-test-v{0,1}.o: Add binary input data. * tests/data/test-abidiff-exit/PR30048-test-2-v{0,1}.o: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-abidiff-exit.cc (in_out_specs): Add the input binaries to this test harness. * tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 65 ++++++++- src/abg-ir.cc | 5 +- tests/data/Makefile.am | 10 ++ .../PR30048-test-2-report-1.txt | 136 ++++++++++++++++++ .../test-abidiff-exit/PR30048-test-2-v0.cc | 78 ++++++++++ .../test-abidiff-exit/PR30048-test-2-v0.o | Bin 0 -> 5216 bytes .../test-abidiff-exit/PR30048-test-2-v1.cc | 39 +++++ .../test-abidiff-exit/PR30048-test-2-v1.o | Bin 0 -> 4768 bytes .../PR30048-test-report-0.txt | 19 +++ .../data/test-abidiff-exit/PR30048-test-v0.c | 12 ++ .../data/test-abidiff-exit/PR30048-test-v0.o | Bin 0 -> 2784 bytes .../data/test-abidiff-exit/PR30048-test-v1.c | 6 + .../data/test-abidiff-exit/PR30048-test-v1.o | Bin 0 -> 2608 bytes .../qualifier-typedef-array-report-1.txt | 40 +++--- tests/test-abidiff-exit.cc | 22 +++ 15 files changed, 403 insertions(+), 29 deletions(-) create mode 100644 tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt create mode 100644 tests/data/test-abidiff-exit/PR30048-test-2-v0.cc create mode 100644 tests/data/test-abidiff-exit/PR30048-test-2-v0.o create mode 100644 tests/data/test-abidiff-exit/PR30048-test-2-v1.cc create mode 100644 tests/data/test-abidiff-exit/PR30048-test-2-v1.o create mode 100644 tests/data/test-abidiff-exit/PR30048-test-report-0.txt create mode 100644 tests/data/test-abidiff-exit/PR30048-test-v0.c create mode 100644 tests/data/test-abidiff-exit/PR30048-test-v0.o create mode 100644 tests/data/test-abidiff-exit/PR30048-test-v1.c create mode 100644 tests/data/test-abidiff-exit/PR30048-test-v1.o new file mode 100644 index 00000000..2af3296f new file mode 100644 index 00000000..23a4c10b new file mode 100644 index 00000000..21499acc index 9b9bd19a..83b3e836 100644 diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index ce6b52d4..79322490 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -424,6 +424,9 @@ pointer_or_qual_die_of_anonymous_class_type(const Dwarf_Die* die); static bool die_is_reference_type(const Dwarf_Die* die); +static bool +die_is_pointer_array_or_reference_type(const Dwarf_Die* die); + static bool die_is_pointer_or_reference_type(const Dwarf_Die* die); @@ -570,6 +573,9 @@ die_function_signature(const reader& rdr, static bool die_peel_qual_ptr(Dwarf_Die *die, Dwarf_Die& peeled_die); +static bool +die_peel_qualified(Dwarf_Die *die, Dwarf_Die& peeled_die); + static bool die_function_type_is_method_type(const reader& rdr, const Dwarf_Die *die, @@ -6912,7 +6918,7 @@ die_is_pointer_type(const Dwarf_Die* die) static bool pointer_or_qual_die_of_anonymous_class_type(const Dwarf_Die* die) { - if (!die_is_pointer_or_reference_type(die) + if (!die_is_pointer_array_or_reference_type(die) && !die_is_qualified_type(die)) return false; @@ -6970,11 +6976,20 @@ die_is_array_type(const Dwarf_Die* die) /// /// @return true iff @p die represents a pointer or reference type. static bool -die_is_pointer_or_reference_type(const Dwarf_Die* die) +die_is_pointer_array_or_reference_type(const Dwarf_Die* die) {return (die_is_pointer_type(die) || die_is_reference_type(die) || die_is_array_type(die));} +/// Test if a DIE represents a pointer or a reference type. +/// +/// @param die the die to consider. +/// +/// @return true iff @p die represents a pointer or reference type. +static bool +die_is_pointer_or_reference_type(const Dwarf_Die* die) +{return (die_is_pointer_type(die) || die_is_reference_type(die));} + /// Test if a DIE represents a pointer, a reference or a typedef type. /// /// @param die the die to consider. @@ -6983,7 +6998,7 @@ die_is_pointer_or_reference_type(const Dwarf_Die* die) /// typedef type. static bool die_is_pointer_reference_or_typedef_type(const Dwarf_Die* die) -{return (die_is_pointer_or_reference_type(die) +{return (die_is_pointer_array_or_reference_type(die) || dwarf_tag(const_cast(die)) == DW_TAG_typedef);} /// Test if a DIE represents a class type. @@ -7225,6 +7240,38 @@ die_peel_qual_ptr(Dwarf_Die *die, Dwarf_Die& peeled_die) return true; } +/// Return the leaf object under a qualified type DIE. +/// +/// @param die the DIE of the type to consider. +/// +/// @param peeled_die out parameter. Set to the DIE of the leaf +/// object iff the function actually peeled anything. +/// +/// @return true upon successful completion. +static bool +die_peel_qualified(Dwarf_Die *die, Dwarf_Die& peeled_die) +{ + if (!die) + return false; + + memcpy(&peeled_die, die, sizeof(peeled_die)); + + int tag = dwarf_tag(&peeled_die); + + bool result = false; + while (tag == DW_TAG_const_type + || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type) + { + if (!die_die_attribute(&peeled_die, DW_AT_type, peeled_die)) + break; + tag = dwarf_tag(&peeled_die); + result = true; + } + + return result; +} + /// Return the leaf object under a typedef type DIE. /// /// @param die the DIE of the type to consider. @@ -9096,9 +9143,15 @@ die_qualified_type_name(const reader& rdr, repr.clear(); else { - if (has_underlying_type_die - && die_is_pointer_or_reference_type(&underlying_type_die)) - repr = underlying_type_repr + " " + repr; + if (has_underlying_type_die) + { + Dwarf_Die peeled; + die_peel_qualified(&underlying_type_die, peeled); + if (die_is_pointer_or_reference_type(&peeled)) + repr = underlying_type_repr + " " + repr; + else + repr += " " + underlying_type_repr; + } else repr += " " + underlying_type_repr; } diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 4a598bde..ff7573ea 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -8740,9 +8740,8 @@ get_name_of_qualified_type(const type_base_sptr& underlying_type, if (!quals_repr.empty()) { - if (is_pointer_type(underlying_type) - || is_reference_type(underlying_type) - || is_array_type(underlying_type)) + if (is_pointer_type(peel_qualified_type(underlying_type)) + || is_reference_type(peel_qualified_type(underlying_type))) { name += " "; name += quals_repr; diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index a4740e3e..1a0a3fa4 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -248,6 +248,16 @@ test-abidiff-exit/btf/test0-v0.c \ test-abidiff-exit/btf/test0-v0.o \ test-abidiff-exit/btf/test0-v1.c \ test-abidiff-exit/btf/test0-v1.o \ +test-abidiff-exit/PR30048-test-report-0.txt \ +test-abidiff-exit/PR30048-test-v0.c \ +test-abidiff-exit/PR30048-test-v1.c \ +test-abidiff-exit/PR30048-test-v0.o \ +test-abidiff-exit/PR30048-test-v1.o \ +test-abidiff-exit/PR30048-test-2-report-1.txt \ +test-abidiff-exit/PR30048-test-2-v0.cc \ +test-abidiff-exit/PR30048-test-2-v0.o \ +test-abidiff-exit/PR30048-test-2-v1.cc \ +test-abidiff-exit/PR30048-test-2-v1.o \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt b/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt new file mode 100644 index 00000000..2650b5a0 --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt @@ -0,0 +1,136 @@ +Functions changes summary: 0 Removed, 7 Changed, 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +7 functions with some indirect sub-type change: + + [C] 'function int[7]* N()' at PR30048-test-2-v0.cc:62:1 has some indirect sub-type changes: + return type changed: + entity changed from 'int[7]*' to 'int' + type size changed from 64 to 32 (in bits) + + [C] 'function int* O()' at PR30048-test-2-v0.cc:64:1 has some indirect sub-type changes: + return type changed: + entity changed from 'int*' to 'int' + type size changed from 64 to 32 (in bits) + + [C] 'function int ()* P()' at PR30048-test-2-v0.cc:67:1 has some indirect sub-type changes: + return type changed: + entity changed from 'int ()*' to 'int' + type size changed from 64 to 32 (in bits) + + [C] 'function amusement* fun()' at PR30048-test-2-v0.cc:57:1 has some indirect sub-type changes: + return type changed: + in pointed to type 'struct amusement' at PR30048-test-2-v1.cc:1:1: + type size changed from 6528 to 768 (in bits) + 24 data member changes: + type of 'int A[7]' changed: + entity changed from 'int[7]' to 'int' + type size changed from 224 to 32 (in bits) + type of 'int* B' changed: + entity changed from 'int*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 256 to 32 (in bits) (by -224 bits) + type of 'int ()* C' changed: + entity changed from 'int ()*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 320 to 64 (in bits) (by -256 bits) + type of 'int D[7][7]' changed: + entity changed from 'int[7][7]' to 'int' + type size changed from 1568 to 32 (in bits) + and offset changed from 384 to 96 (in bits) (by -288 bits) + type of 'int* E[7]' changed: + entity changed from 'int*[7]' to 'int' + type size changed from 448 to 32 (in bits) + and offset changed from 1984 to 128 (in bits) (by -1856 bits) + type of 'int ()* F[7]' changed: + entity changed from 'int ()*[7]' to 'int' + type size changed from 448 to 32 (in bits) + and offset changed from 2432 to 160 (in bits) (by -2272 bits) + type of 'int[7]* G' changed: + entity changed from 'int[7]*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 2880 to 192 (in bits) (by -2688 bits) + type of 'int** H' changed: + entity changed from 'int**' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 2944 to 224 (in bits) (by -2720 bits) + type of 'int ()* I' changed: + entity changed from 'int ()*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3008 to 256 (in bits) (by -2752 bits) + type of 'int[7]* ()* J' changed: + entity changed from 'int[7]* ()*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3072 to 288 (in bits) (by -2784 bits) + type of 'int* ()* K' changed: + entity changed from 'int* ()*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3136 to 320 (in bits) (by -2816 bits) + type of 'int ()* ()* L' changed: + entity changed from 'int ()* ()*' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3200 to 352 (in bits) (by -2848 bits) + type of 'volatile int a[7]' changed: + entity changed from 'volatile int[7]' to 'int' + type size changed from 224 to 32 (in bits) + and offset changed from 3264 to 384 (in bits) (by -2880 bits) + type of 'volatile int* const b' changed: + entity changed from 'volatile int* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3520 to 416 (in bits) (by -3104 bits) + type of 'int ()* const c' changed: + entity changed from 'int ()* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 3584 to 448 (in bits) (by -3136 bits) + type of 'volatile int d[7][7]' changed: + entity changed from 'volatile int[7][7]' to 'int' + type size changed from 1568 to 32 (in bits) + and offset changed from 3648 to 480 (in bits) (by -3168 bits) + type of 'volatile int* const e[7]' changed: + entity changed from 'volatile int* const[7]' to 'int' + type size changed from 448 to 32 (in bits) + and offset changed from 5248 to 512 (in bits) (by -4736 bits) + type of 'int ()* const f[7]' changed: + entity changed from 'int ()* const[7]' to 'int' + type size changed from 448 to 32 (in bits) + and offset changed from 5696 to 544 (in bits) (by -5152 bits) + type of 'volatile int[7]* const g' changed: + entity changed from 'volatile int[7]* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6144 to 576 (in bits) (by -5568 bits) + type of 'volatile int* const* const h' changed: + entity changed from 'volatile int* const* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6208 to 608 (in bits) (by -5600 bits) + type of 'int ()* const i' changed: + entity changed from 'int ()* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6272 to 640 (in bits) (by -5632 bits) + type of 'volatile int[7]* ()* const j' changed: + entity changed from 'volatile int[7]* ()* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6336 to 672 (in bits) (by -5664 bits) + type of 'volatile int* ()* const k' changed: + entity changed from 'volatile int* ()* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6400 to 704 (in bits) (by -5696 bits) + type of 'int ()* ()* const l' changed: + entity changed from 'int ()* ()* const' to 'int' + type size changed from 64 to 32 (in bits) + and offset changed from 6464 to 736 (in bits) (by -5728 bits) + + [C] 'function volatile int[7]* n()' at PR30048-test-2-v0.cc:72:1 has some indirect sub-type changes: + return type changed: + entity changed from 'volatile int[7]*' to 'int' + type size changed from 64 to 32 (in bits) + + [C] 'function volatile int* o()' at PR30048-test-2-v0.cc:74:1 has some indirect sub-type changes: + return type changed: + entity changed from 'volatile int*' to 'int' + type size changed from 64 to 32 (in bits) + + [C] 'function int ()* p()' at PR30048-test-2-v0.cc:77:1 has some indirect sub-type changes: + return type changed: + entity changed from 'int ()*' to 'int' + type size changed from 64 to 32 (in bits) + diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-v0.cc b/tests/data/test-abidiff-exit/PR30048-test-2-v0.cc new file mode 100644 index 00000000..5c1cbe07 --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-2-v0.cc @@ -0,0 +1,78 @@ +struct amusement { + // declare A as array 7 of int + int A[7]; + // declare B as pointer to int + int *B; + // declare C as pointer to function (void) returning int + int (*C)(void ); + // declare D as array 7 of array 7 of int + int D[7][7]; + // declare E as array 7 of pointer to int + int *E[7]; + // declare F as array 7 of pointer to function (void) returning int + int (*F[7])(void ); + // declare G as pointer to array 7 of int + int (*G)[7]; + // declare H as pointer to pointer to int + int **H; + // declare I as pointer to function (void) returning int + int (*I)(void ); + // declare J as pointer to function (void) returning pointer to array 7 of int + int (*(*J)(void ))[7]; + // declare K as pointer to function (void) returning pointer to int + int *(*K)(void ); + // declare L as pointer to function (void) returning pointer to function + // (void) returning int + int (*(*L)(void ))(void ); + + // declare a as array 7 of volatile int + volatile int a[7]; + // declare b as const pointer to volatile int + volatile int * const b; + // declare c as const pointer to function (void) returning int + int (* const c)(void ); + // declare d as array 7 of array 7 of volatile int + volatile int d[7][7]; + // declare e as array 7 of const pointer to volatile int + volatile int * const e[7]; + // declare f as array 7 of const pointer to function (void) returning int + int (* const f[7])(void ); + // declare g as const pointer to array 7 of volatile int + volatile int (* const g)[7]; + // declare h as const pointer to const pointer to volatile int + volatile int * const * const h; + // declare i as const pointer to function (void) returning int + int (* const i)(void ); + // declare j as const pointer to function (void) returning pointer to array 7 + //of volatile int + volatile int (*(* const j)(void ))[7]; + // declare k as const pointer to function (void) returning pointer to + //volatile int + volatile int *(* const k)(void ); + // declare l as const pointer to function (void) returning pointer to + //function (void) returning int + int (*(* const l)(void ))(void ); +}; + +struct amusement * fun(void) { return 0; } + +// declare M as function (void) returning int +int M(void ) { return 0; } +// declare N as function (void) returning pointer to array 7 of int +int (*N(void ))[7] { return 0; } +// declare O as function (void) returning pointer to int +int *O(void ) { return 0; } +// declare P as function (void) returning pointer to function (void) returning +//int +int (*P(void ))(void ) { return 0; } + +// declare m as function (void) returning int +int m(void ) { return 0; } +// declare n as function (void) returning pointer to array 7 of volatile int +volatile int (*n(void ))[7] { return 0; } +// declare o as function (void) returning pointer to volatile int +volatile int *o(void ) { return 0; } +// declare p as function (void) returning pointer to function (void) returning +//int +int (*p(void ))(void ) { return 0; } + diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-v0.o b/tests/data/test-abidiff-exit/PR30048-test-2-v0.o new file mode 100644 index 0000000000000000000000000000000000000000..a4eafe8d27c2c6d0b4dc94a0407c119cda6124a0 GIT binary patch literal 5216 zcmcInO>A4o5uSaIPb5wK(3V}xmK{B&b}YpuMarrpJGP=&i7hFXZKy~q6bWRKdZHMM zq)JkPk`{<_=wE^YZqfn{5ELz16v-in_L2bg!9{_fKrguj=%I%mS`@wX2fY++fp)%q zJJR!-j*1o;;O)+QGqbatot^ji^3#_uI!cj{qDk731SRtOcK9jHPSF9{PtVSL^Y`yV ze*PDq6#I%xh^mE}wXsQi)fY`@6bGJ;^tLDRqhZl5aD+s?-eaO}@+Qx>B>$uidwlnxg}$_ZYpY z)H8H&&(E3thEkX5aOzjg-cqVaN7KJ!_O?mYVU}FAN+BMMCT4T7&{;E5JPUdp63CX34N0vG3x+}{gDT)MOw7hnEVY2 zWDrRTu~;{=T}UOeWiX#v2kXVg!NDUo$y{8EGt9;2AtI3T1&Gh_;H}fVP7L-bq>G6K z^_JJ5Iei7-B@|KDX(kOAF@z%O8eQ}NBgaA!^);IQxY$=|staC7rclKD3QcNnWL+qt zo~Lsk7kg!+PG|PR?`6JdLOcFW4w&j8H*q$j9#5S~&Gt|5f=(Z$GKtxK&U=Pt`$sdp z#n>avaV~T8#G!5TdhcxiUbQbiHSp3QJ}tgL{fdp^2efVC-i0}C^0Qj8XRkWm+n;iW z28ZCCK1h`6S8i|0JDb8TutxVWN~I=KZZFrfVbLZ&!%uh)x@lnlnxcI|FwEcO$D;&2 z%Cl1HpS?YpkWGG=8PbV$)R5B`IbQD}N^Xnpgz`?zd5!oOgK9+n@K2&UyZ# z*O&JO=Dfj0Z=m31=DcGOo1=N}kvVUKRe7Tl8^__u#o9(Is0Dmam%do2Z(>~6;}tz# z+oZKdz2a}wTh&TESoU$FFI{=opFVlA@R(m1%Z=p<{#br&tWX#$_`?fqGE;0DMRt6| z&(_)-_27IZs0YnznZ;tWyn23X;&k@(xSy>cU`>Z==y6_;S23RAy4j@B)kZBCU2ZJD zP#vvQ+oNmMQn6I66sv2aE7h%_HQEkZ?bhgWv0c<`mbJ^(m6dF;Rc+I?g;V+b_(T>) z*|F?qK36V(5=(ZBLzkwf&-%lhu95#DQ(Oz0Vm$i%;6|}4mzlZ?Oh_47R}6#tV)3kA zS|GKRR)gK~#4T1HVGIvQ-?b-u(_eF@d%7;N0b|gegOce%`sYIR1NC3oMgP_=`a8Sm zf3u7JU%Tj!m?U-jea7{^2`(}E>%Z?)FyP|4b|9BMIuXAbJHfn8@&UNs>3uqvy6?k2 z#mK(Me#G-3gNrQlF@wVoBsf|U*2!pe2hSTEtqvsirE@ z9$&TWzi!rf-LjYSc*n9w9MDfJ`wJn=UyLCm`+3FSA6oWOAAhjyj~M$uTlP|CUFI7> z)_=p;_ZnP&Z^q!qEqghqtYt6wQ%>K7J6B;8N$5YrR-&7fU?1o8i1FTszomQx4w*lqnjb`X}(x0HG|E2)Wv48UJ34XS*z9qap4fc0$$Q`xlz;KP`P@e9pw0} zoo%&?6;ZOU&#zFQ*ilV&)3r=BRDu>hdXwtbY z;~arSYZb~LV(37&{|UB1kNsc$QP1|82rKcwYAtNrqTbNgr}&A|O)K5wdNsvChU|{*m#=do)V6?K7M0tT{eml*35-|x}pbUmDO{_xde$6sd*Ysx;2IepK>|A7EzmiRJ%nek5k zPnd%K*)IOCJ;47T#$VpIvW&!)`8&p6^fHei*&RsyMD-(PU~0-tV9FbRJ1>$yF}%YJ z*0lYv8~+I_pzZ%2`*u3No96s}Z33Zw()@_O)PJYgaJg*^Z=3l1XIT5%{-_D-io%`p e=KfvL(#~N09NNpOPX3GhmmBm!IBk!%|9=4AueON* literal 0 HcmV?d00001 diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-v1.cc b/tests/data/test-abidiff-exit/PR30048-test-2-v1.cc --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-2-v1.cc @@ -0,0 +1,39 @@ +struct amusement { + int A; + int B; + int C; + int D; + int E; + int F; + int G; + int H; + int I; + int J; + int K; + int L; + + int a; + int b; + int c; + int d; + int e; + int f; + int g; + int h; + int i; + int j; + int k; + int l; +}; + +struct amusement * fun() { return 0; } + +int M() { return 0; } +int N() { return 0; } +int O() { return 0; } +int P() { return 0; } + +int m() { return 0; } +int n() { return 0; } +int o() { return 0; } +int p() { return 0; } diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-v1.o b/tests/data/test-abidiff-exit/PR30048-test-2-v1.o new file mode 100644 index 0000000000000000000000000000000000000000..fdf59d1e66336d73bd48e6ecf651cb4a48728e48 GIT binary patch literal 4768 zcmcInTW=dx5T0YliBsp|+}bn^#4c%@()!w{4ZXTan@cZgRHziHLbA5kj@#Id>`h1u z6-WrwiU&XfsYn$ctjw<%jEkAfn(TtXskY%(t%NlnqnR1Kn_C^6sw>$$sO>{{@eD0DPeQG>eyRVY;~` z<1!iu&nxBc#>Y^n!9yCBFH4aS#y43{O*}ZBKnu+OG zQ?QLdNS%WKfkAa1S_llO3(!j7pfaGHKwPCENMKlHpo74O%0efB#LHQSU8OX&E$+e;j`Zhv`M?h^qgG1&+15&m z&JZsI1NL!x)PSem^?1HMXkIhD{mS>!Ip5w{Uvu2odCu2^AhtQ!I>zI{ndhz^!mV9_ zxvPmw_8qZNT&|i$6UzM!JwU3X8E^Vb!e0D7qTU8kS+h2zs-H zTrOg+7OdyYuDPI^ButEr9SsfPHtqixI|S6WLU>WpV-8l6dTh5cv`G}(c444x*FN#L zE`wSPs$DHj{!h@^j~rbj_UmxEE%>2lthI3*1CS%%adM(;=D+5+H}$`>h5!B*{_nQ% z|G0(!uPyxjyh*j5k5e}&N@;-K|K8w0!b@*u4e{Eiw$b5*#*HL0UTEHgw^zEs=Y^IH z+;(I-UF(s|7nv7Z^dR$;MqZ&^(#b4C; zN#--PdBUmt6#jJ2MOSjMAx`vb;tG1kP>yz>5rxU_`7&2dA_%lNWir?mLDIDSHl zmwkUzi*MujoE9(VcUz0U%kdv*@lpr(wRoyGk_TG6)YBs^Ue4)>79VzofgiN^_nH4i ziPf<*Blk(;2@bszJx{}fBITZ?yC=j;emy!~U89YNMIKAW(c0mV~Yy~?)i zhwz^=pI|NgH*6nct&bmKo|el?wwaX1%k$1_yzJY18Xso+D~*?RKh}7uho3cmlx=JU zw#YiAKBfMJmpX@N^=8pB(x|P9qZb5O=Bfoz`o2RnU9Cd2VlEodteIZU&lO6!GWu+6 zq|+61Eo$#a|+B*G;=2O6X&i~a(=xQ@hs5u_o18K z(f^uH^{kIcGs^tO+(la>mg>T=P%|Flc&vP!# zPrpv|`InHRF=d?yZE2@LQ9gFm+Fj-s{Wf}P<$uZfkJd6BAbFxc+9dyV{LGtx|k^Pe)>9;PeMbCf8^N+|vIYH0=7WrD|_n6P` zDd*Ao1@V%6ssCDYQ_64LQ10>k^e>ij^?a%c{oO|j?r`8V87|Qt2RhJKEB{`Llk~kS Im!O{i4?;9}cK`qY literal 0 HcmV?d00001 diff --git a/tests/data/test-abidiff-exit/PR30048-test-report-0.txt b/tests/data/test-abidiff-exit/PR30048-test-report-0.txt --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-report-0.txt @@ -0,0 +1,19 @@ +Functions changes summary: 0 Removed, 0 Changed, 0 Added function +Variables changes summary: 0 Removed, 1 Changed, 0 Added variable + +1 Changed variable: + + [C] 'S s' was changed at PR30048-test-v1.c:6:1: + size of symbol changed from 56 to 16 + type of variable changed: + type size changed from 448 to 128 (in bits) + 5 data member deletions: + 'int (int)* f01', at offset 0 (in bits) at PR30048-test-v0.c:2:1 + 'int (const int*)* f02', at offset 64 (in bits) at PR30048-test-v0.c:3:1 + 'int (int* const)* f03', at offset 128 (in bits) at PR30048-test-v0.c:4:1 + 'int (int* restrict)* f04', at offset 192 (in bits) at PR30048-test-v0.c:5:1 + 'int (const int* restrict)* f05', at offset 256 (in bits) at PR30048-test-v0.c:6:1 + 2 data member changes: + 'int (int* restrict const)* f06' offset changed from 320 to 0 (in bits) (by -320 bits) + 'int (int* restrict const)* f07' offset changed from 384 to 64 (in bits) (by -320 bits) + diff --git a/tests/data/test-abidiff-exit/PR30048-test-v0.c b/tests/data/test-abidiff-exit/PR30048-test-v0.c new file mode 100644 index 00000000..b00f6d7d --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-v0.c @@ -0,0 +1,12 @@ +struct S { + int (*f01)(int); + int (*f02)(const int*); + int (*f03)(int* const); + int (*f04)(int* restrict); + int (*f05)(const int* restrict); + int (*f06)(int* restrict const); + int (*f07)(int* const restrict); +}; + +struct S s; + diff --git a/tests/data/test-abidiff-exit/PR30048-test-v0.o b/tests/data/test-abidiff-exit/PR30048-test-v0.o new file mode 100644 index 0000000000000000000000000000000000000000..91e136f4e8d9a108aed18b7af55d92415ef5c1d4 GIT binary patch literal 2784 zcmbtU&2Jk;6o2F0b=F?eCN+hY0@)x+(+aOYY7!HaVks(Z1VU92=diZd&VoN8dsAG2 z#EnY@LI{a#4~PpFgoL>Ez=aDJE?oEr5SN}g!26A7ob6?CU{u}Yk-s!Yq`_&HgM_2n{WHOwJpC^59&e9 zuUG5!TCHC5H*QB=|7Mt|K)G?*FAtNWQMA*KM$shhup3S~2RpOoW_h#Wm-}?<_SI^& z(JUv?G%4Sy1|6y#jE7OBJMO+4SNd^M8N}_d9rwd{Q0c|9Xj(z)w9*ZeP{J}tyK%2q zj%IQ4KdVpf<|IQmc6Yb^4L*a*|Kb4TdD*OeejI+dj&DRf0H;MLUmmt5Gc4jZJ^U*p zL>5P~#Nux%ODrm6(cFipGD9qS>;%j6N2^?+rK!QmQ=1~BXRyflxQb|5)q%$uX*r_+ z`1D&mVemTdsT7|+jf?7FVdVcx<>{X2pBis^F4YG)x0L^)!GEg!n!(>!J_Xae!z668 zO(t`DpivUd5(+TI6tt&P3MSDY47ySKsJ|bNdSi}B9Jbq&=*}bIa1xIC(W51UcogXp zUP43A`_k`>hr@_}m%(V9L;+7>d76Zs_mtls9R-Jz@nJMc?&{6|cYA?Lan|~Lb*GjF zhE>`EvO7J>o0K*X6>Kq7jvq5`O0d8`!stZ)`DUQjG*BX<^=QC;wLRL zHI$zza)m7@{axUX4cXzx>PwXGx zlezycb7oJbsF;H$+MJt(HgoqmlC{3C*1xGLu|ED{=K6=sp=Xt!w6xUvc)zsh^|k$g zgIV?WRQ-49VwDR@*WXjvTz^LmWCh77(RJE>!7+_fX*4hgS_RGAub9WZsO>IV9IASA zU;6xXBKn!Nh}~E958$w@@{@J{xRb1{zJp6;IXgECZSEg^v+57j{r|A2oCCA|Z!wtY AYXATM literal 0 HcmV?d00001 diff --git a/tests/data/test-abidiff-exit/PR30048-test-v1.c b/tests/data/test-abidiff-exit/PR30048-test-v1.c --- /dev/null +++ b/tests/data/test-abidiff-exit/PR30048-test-v1.c @@ -0,0 +1,6 @@ +struct S { + int (*f06)(int* restrict const); + int (*f07)(int* const restrict); +}; + +struct S s; diff --git a/tests/data/test-abidiff-exit/PR30048-test-v1.o b/tests/data/test-abidiff-exit/PR30048-test-v1.o new file mode 100644 index 0000000000000000000000000000000000000000..161e45656fc168d917eae9b9bca9465786d35205 GIT binary patch literal 2608 zcmbtW-EI>{6h5R72p$5ixhUsb&)CakE1~vCGv}P|{LP*@WBK7%U*E8V zAWed<(L~cI(I7vO>xo#W5}lx*S2$EGRwEzJp0sIxBGm1VLdEG({&4Y5G^ zJIt`Ae&CI!bNR3rlLe%3kGJA|-mE%rGZBfYnU7g2CWTnwRI_9k))vK8=gY<7W@*)7 z=i}ro7B)+Ko_X=%&$iE)3nAVdn*~F2d9kpN^w|;% z*6~rAB+1QhzH>LKD{i&s*ZitmtJG@MYOU&CzAIbqtsqtgZ|REbb>qFBT<^%99EMF+ zgJE-L{a|(3TV8U#4sG52qEcB}^gmHN{Yy^$46NJ0v zc6cD8GF+o_D~N+c^w`=8+ig!Cgz^83K6;v?2;JP+SaUCP53amN1JJJ=FP9g_lf(Ez z#33+ELg`7bHJHI+&(Z6DGE6+z>5LN(o2Dj8O0ub#(k7x!Jf0b3(+5XT9!8oUy{N=C zr#+4~ErLmp;0()?=Rq{9;(((^nocMIc={_&8MyZQD21oHv9ECSZ(7M7N_;Bc)dj{CB03A3f;CL4$cb9Pu43#quB~A45!jBZ|l$%H6s=yl|~A-iEu>JToWMZnvM-t2d~l7F@QUO$#TPoWpZLGvf2cY1sN zVAvnXVf;WJ{=f6H9Ex7+{_0G1Eg0OK`$e_`OV0>G>ew>KjK9P_n6-b4AJ3`EW$L(3 zGbdc@*q9!U*myU6F(;V6`q*P6yif;vtZ>wYpMDqk!3M4KGIIidj*aP;5gYHO?-pB3 z49-^-=t4=6>3f@PS?B*=Jt}=poFDJWJb#NZGbclIUxCX|Qe^sWvn{LsK-IscVo@Kz zVrKmTW5`+Im8K`E5WX)>y1wT4zmOIGQaSvU4pzQ^bo{SMHtRpK;6+p(vGK0sH2;k) zS{^&G@Jz+0G03LxAB^E%O!q?tnCH^{LoN{VnX$lMDew>q(>$-N`^TM_Zx8-|D)1zf V6q)Bo-mLhi>i+*u#X>aW-vSvc)T#gg literal 0 HcmV?d00001 diff --git a/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt b/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt --- a/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt +++ b/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt @@ -47,39 +47,39 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable underlying type 'typedef A' at qualifier-typedef-array-v0.c:1:1 changed: entity changed from 'typedef A' to compatible type 'void*[7]' type of 'C v_c' changed: - entity changed from 'typedef C' to compatible type 'const volatile void*[7]' + entity changed from 'typedef C' to compatible type 'void* const volatile[7]' array element type 'void* const' changed: - 'void* const' changed to 'const volatile void*' - type name changed from 'void* const[7]' to 'const volatile void*[7]' + 'void* const' changed to 'void* const volatile' + type name changed from 'void* const[7]' to 'void* const volatile[7]' type size hasn't changed type of 'C r_c' changed: - entity changed from 'typedef C' to compatible type 'restrict const void*[7]' + entity changed from 'typedef C' to compatible type 'void* restrict const[7]' array element type 'void* const' changed: - 'void* const' changed to 'restrict const void*' - type name changed from 'void* const[7]' to 'restrict const void*[7]' + 'void* const' changed to 'void* restrict const' + type name changed from 'void* const[7]' to 'void* restrict const[7]' type size hasn't changed type of 'D v_d' changed: - entity changed from 'typedef D' to compatible type 'const volatile void*[7]' + entity changed from 'typedef D' to compatible type 'void* const volatile[7]' array element type 'void* const' changed: - 'void* const' changed to 'const volatile void*' - type name changed from 'void* const[7]' to 'const volatile void*[7]' + 'void* const' changed to 'void* const volatile' + type name changed from 'void* const[7]' to 'void* const volatile[7]' type size hasn't changed type of 'D r_d' changed: - entity changed from 'typedef D' to compatible type 'restrict const void*[7]' + entity changed from 'typedef D' to compatible type 'void* restrict const[7]' array element type 'void* const' changed: - 'void* const' changed to 'restrict const void*' - type name changed from 'void* const[7]' to 'restrict const void*[7]' + 'void* const' changed to 'void* restrict const' + type name changed from 'void* const[7]' to 'void* restrict const[7]' type size hasn't changed type of 'E r_e' changed: - entity changed from 'typedef E' to compatible type 'restrict const volatile void*[7]' - array element type 'const volatile void*' changed: - 'const volatile void*' changed to 'restrict const volatile void*' - type name changed from 'const volatile void*[7]' to 'restrict const volatile void*[7]' + entity changed from 'typedef E' to compatible type 'void* restrict const volatile[7]' + array element type 'void* const volatile' changed: + 'void* const volatile' changed to 'void* restrict const volatile' + type name changed from 'void* const volatile[7]' to 'void* restrict const volatile[7]' type size hasn't changed type of 'F r_f' changed: - entity changed from 'typedef F' to compatible type 'restrict const volatile void*[7]' - array element type 'const volatile void*' changed: - 'const volatile void*' changed to 'restrict const volatile void*' - type name changed from 'const volatile void*[7]' to 'restrict const volatile void*[7]' + entity changed from 'typedef F' to compatible type 'void* restrict const volatile[7]' + array element type 'void* const volatile' changed: + 'void* const volatile' changed to 'void* restrict const volatile' + type name changed from 'void* const volatile[7]' to 'void* restrict const volatile[7]' type size hasn't changed diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc index df2f087c..2424675f 100644 --- a/tests/test-abidiff-exit.cc +++ b/tests/test-abidiff-exit.cc @@ -471,6 +471,28 @@ InOutSpec in_out_specs[] = "data/test-abidiff-exit/test-rhbz2114909-report-1.txt", "output/test-abidiff-exit/test-rhbz2114909-report-1.txt" }, + { + "data/test-abidiff-exit/PR30048-test-v0.o", + "data/test-abidiff-exit/PR30048-test-v1.o", + "", + "", + "", + "--no-default-suppression", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/PR30048-test-report-0.txt", + "output/test-abidiff-exit/PR30048-test-report-0.txt" + }, + { + "data/test-abidiff-exit/PR30048-test-2-v0.o", + "data/test-abidiff-exit/PR30048-test-2-v1.o", + "", + "", + "", + "--no-default-suppression", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/PR30048-test-2-report-1.txt", + "output/test-abidiff-exit/PR30048-test-2-report-1.txt" + }, #ifdef WITH_BTF { "data/test-abidiff-exit/btf/test0-v0.o",