From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB3DB388700C; Tue, 7 Apr 2020 16:08:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB3DB388700C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586275692; bh=zqeLK/oJjbFhfExvHVOpiP0ia5Y7gJhBdKvH+YJ0U44=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EJq8GPTIGmjPRPnjkWupjMQVkkD60fGj8eDM68oZenbPSmlE+Bi1pAwLDbHe+PCoO Xjkb8osPZblMhMHsLNequ8hlzakmTnUwifvrsh/r48w4SnNQLBL6KsDKeTa3CTQyWD kCM5QdFV0qX7rVb79Yfhz1C/jL8OszyhZ74rNJCk= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94510] [9/10 Regression] nullptr_t implicitly cast to zero twice in std::array Date: Tue, 07 Apr 2020 16:08:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:08:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94510 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot g= nu.org Status|NEW |ASSIGNED --- Comment #9 from Martin Sebor --- The changed code in reshape_init_array_1 checks for integer/pointer mismatc= hes via the following test: /* Pointers initialized to strings must be treated as non-zero even if the string is empty. */ tree init_type =3D TREE_TYPE (elt_init); if (POINTER_TYPE_P (elt_type) !=3D POINTER_TYPE_P (init_type) || !type_initializer_zero_p (elt_type, elt_init)) last_nonzero =3D index; ...and a test case involving an ordinary pointer is diagnosed: $ cat t.C && gcc -S -Wall t.C int a[2] =3D { nullptr }; int b[2] =3D { (void*)0 }; t.C:2:23: error: invalid conversion from =E2=80=98void*=E2=80=99 to =E2=80= =98int=E2=80=99 [-fpermissive] 2 | int b[2] =3D { (void*)0 }; | ^ | | | void* but a nullptr use is not. (gdb) p debug_tree (init_type) $6 =3D (tree) 0x7fffea9521f8 constant 64> unit-size constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea9521f8> I would expect POINTER_TYPE_P (init_type) to be non-zero but it's not: (gdb) p POINTER_TYPE_P (init_type) $7 =3D false=