public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/97840] [11 regression] Bogus -Wmaybe-uninitialized
Date: Sun, 15 Nov 2020 17:57:44 +0000	[thread overview]
Message-ID: <bug-97840-4-NqqKzKJSXM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97840-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97840

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, on x86_64 the corresponding warning does not trigger since TYPE_EMPTY_P is
true.

x86_64 compiler I get:
(gdb) p debug_tree (rhstype)
 <record_type 0x7ffff7624498 allocator sizes-gimplified addressable
needs-constructing cxx-odr-p type_1 type_4 type_5 type_6 BLK
    size <integer_cst 0x7ffff744af90 type <integer_type 0x7ffff74690a8
bitsizetype> constant 8>
    unit-size <integer_cst 0x7ffff744afa8 type <integer_type 0x7ffff7469000
sizetype> constant 1>
    align:8 warn_if_not_align:0 symtab:0 alias-set 76 canonical-type
0x7ffff7624498
    fields <field_decl 0x7ffff685a1c8 D.14377
        type <record_type 0x7ffff684a888 new_allocator sizes-gimplified
addressable needs-constructing cxx-odr-p type_1 type_4 type_5 type_6 BLK size
<integer_cst 0x7ffff744af90 8> unit-size <integer_cst 0x7ffff744afa8 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set 77 canonical-type
0x7ffff684a888 fields <function_decl 0x7ffff6858500 operator=> context
<namespace_decl 0x7ffff7478b48 __gnu_cxx>
            full-name "class __gnu_cxx::new_allocator<char>"
            needs-constructor needs-destructor X() X(constX&) this=(X&)
n_parents=0 use_template=1 interface-unknown
            pointer_to_this <pointer_type 0x7ffff684f000> reference_to_this
<reference_type 0x7ffff685b738> chain <type_decl 0x7ffff6845c78 new_allocator>>
        ignored decl_6 BLK
/opt/gcc/test/Build/aarch64-suse-linux/libstdc++-v3/include/bits/allocator.h:116:11
        size <integer_cst 0x7ffff744aed0 constant 0> unit-size <integer_cst
0x7ffff744aed0 0>
        align:8 warn_if_not_align:0 offset_align 8 offset <integer_cst
0x7ffff744aed0 0>
        bit-offset <integer_cst 0x7ffff744af18 constant 0> context <record_type
0x7ffff7624498 allocator>
        chain <template_decl 0x7ffff6855b00 rebind type <record_type
0x7ffff6854a80 rebind>
            ignored decl_1 VOID
/opt/gcc/test/Build/aarch64-suse-linux/libstdc++-v3/include/bits/allocator.h:129:9
            align:1 warn_if_not_align:0 context <record_type 0x7ffff7624498
allocator>
            parms <tree_list 0x7ffff6859208 purpose <integer_cst 0x7ffff744afa8
1>
                value <tree_vec 0x7ffff6856980 type <template_decl
0x7ffff6855b00 rebind>
                    length:1
                    elt:0 <tree_list 0x7ffff68591e0 value <type_decl
0x7ffff684de40 _Tp1>>>>
            full-name "template<class _Tp1> struct
std::allocator<char>::rebind" chain <function_decl 0x7ffff6858200 __ct >>>
context <namespace_decl 0x7ffff7466098 std>
    full-name "class std::allocator<char>"
    needs-constructor needs-destructor X() X(constX&) this=(X&) n_parents=1
use_template=3 interface-only
    pointer_to_this <pointer_type 0x7ffff685b0a8> reference_to_this
<reference_type 0x7ffff685b5e8> chain <type_decl 0x7ffff76238e8 allocator>>
$50 = void
(gdb) p rhstype->type_common.empty_flag
$51 = 1


while on aarch64 I get:

(gdb) p debug_tree (rhstype)
 <record_type 0x7ffff71ff3f0 allocator sizes-gimplified addressable
needs-constructing cxx-odr-p type_1 type_4 type_5 type_6 BLK
    size <integer_cst 0x7ffff7466030 type <integer_type 0x7ffff74640a8
bitsizetype> constant 8>
    unit-size <integer_cst 0x7ffff7466048 type <integer_type 0x7ffff7464000
sizetype> constant 1>
    align:8 warn_if_not_align:0 symtab:0 alias-set 76 canonical-type
0x7ffff71ff3f0
    fields <field_decl 0x7ffff6636688 D.16017
        type <record_type 0x7ffff66297e0 new_allocator sizes-gimplified
addressable needs-constructing cxx-odr-p type_1 type_4 type_5 type_6 BLK size
<integer_cst 0x7ffff7466030 8> unit-size <integer_cst 0x7ffff7466048 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set 77 canonical-type
0x7ffff66297e0 fields <function_decl 0x7ffff6639300 operator=> context
<namespace_decl 0x7ffff7186428 __gnu_cxx>
            full-name "class __gnu_cxx::new_allocator<char>"
            needs-constructor needs-destructor X() X(constX&) this=(X&)
n_parents=0 use_template=1 interface-unknown
            pointer_to_this <pointer_type 0x7ffff6629690> reference_to_this
<reference_type 0x7ffff6638690> chain <type_decl 0x7ffff662a1c8 new_allocator>>
        ignored decl_6 BLK
/opt/gcc/test/Build/aarch64-suse-linux/libstdc++-v3/include/bits/allocator.h:116:11
        size <integer_cst 0x7ffff744af60 constant 0> unit-size <integer_cst
0x7ffff744af60 0>
        align:8 warn_if_not_align:0 offset_align 8 offset <integer_cst
0x7ffff744af60 0>
        bit-offset <integer_cst 0x7ffff744afa8 constant 0> context <record_type
0x7ffff71ff3f0 allocator>
        chain <template_decl 0x7ffff6635b00 rebind type <record_type
0x7ffff6634930 rebind>
            ignored decl_1 VOID
/opt/gcc/test/Build/aarch64-suse-linux/libstdc++-v3/include/bits/allocator.h:129:9
            align:1 warn_if_not_align:0 context <record_type 0x7ffff71ff3f0
allocator>
            parms <tree_list 0x7ffff6633898 purpose <integer_cst 0x7ffff7466048
1>
                value <tree_vec 0x7ffff6637020 type <template_decl
0x7ffff6635b00 rebind>
                    length:1
                    elt:0 <tree_list 0x7ffff6633870 value <type_decl
0x7ffff6636390 _Tp1>>>>
            full-name "template<class _Tp1> struct
std::allocator<char>::rebind" chain <function_decl 0x7ffff6639000 __ct >>>
context <namespace_decl 0x7ffff7460098 std>
    full-name "class std::allocator<char>"
    needs-constructor needs-destructor X() X(constX&) this=(X&) n_parents=1
use_template=3 interface-only
    pointer_to_this <pointer_type 0x7ffff6638000> reference_to_this
<reference_type 0x7ffff6638540> chain <type_decl 0x7ffff72011c8 allocator>>
$21 = void
(gdb) p rhstype->type_common.empty_flag
$22 = 0

that is set by
1972      /* Handle empty records as per the x86-64 psABI.  */
1973      TYPE_EMPTY_P (type) = targetm.calls.empty_record_p (type);

So I suppose relying on TYPE_EMPTY_P to silence false positives on empty
structures is not very portable.

  parent reply	other threads:[~2020-11-15 17:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 16:14 [Bug middle-end/97840] New: " schwab@linux-m68k.org
2020-11-15 17:15 ` [Bug middle-end/97840] " hubicka at gcc dot gnu.org
2020-11-15 17:31 ` hubicka at gcc dot gnu.org
2020-11-15 17:57 ` hubicka at gcc dot gnu.org [this message]
2020-11-15 18:03 ` hubicka at gcc dot gnu.org
2020-11-16  1:22 ` msebor at gcc dot gnu.org
2020-11-16  7:27 ` rguenth at gcc dot gnu.org
2020-11-16  7:34 ` hubicka at gcc dot gnu.org
2020-11-16 15:32 ` cvs-commit at gcc dot gnu.org
2020-11-16 16:43 ` schwab@linux-m68k.org
2020-11-16 18:18 ` hubicka at gcc dot gnu.org
2020-11-16 20:11 ` jakub at gcc dot gnu.org
2020-11-16 20:18   ` Jan Hubicka
2020-11-16 20:18 ` hubicka at ucw dot cz
2020-11-16 20:30 ` jakub at gcc dot gnu.org
2020-11-16 20:37   ` Jan Hubicka
2020-11-16 20:37 ` hubicka at ucw dot cz
2020-11-16 21:54 ` msebor at gcc dot gnu.org
2020-11-16 22:01   ` Jan Hubicka
2020-11-16 22:01 ` hubicka at ucw dot cz
2020-11-17  3:02 ` cvs-commit at gcc dot gnu.org
2020-11-24  0:35 ` msebor at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97840-4-NqqKzKJSXM@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).