From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 477333861038; Tue, 3 Sep 2024 15:46:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 477333861038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1725378402; bh=B/WR5CnXOjSlPKP71yFjzS2X1k83ejStfhd7vuObQbM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TE6pA7i2E22Z/bHy3vUrNAm+ES58XqlzHUJbqojleFwPD/jjmieONSqef+yp0lkut S5nKl4wtQjIAXx/ABWeWl2H/n6GoY3eGR6eBmZwUWq9lSwz2afcUaVGic4X9I6VP6e 2t3bEe7+VkgoLzR1X8C4fM4QO34wVkyjbHw0pik8= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/116572] [14/15 Regression] Using a std::string passed to a virtual member function of a side-casted pointer spuriously ICEs (wrong code with checking disable) Date: Tue, 03 Sep 2024 15:46:42 +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: 14.2.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D116572 --- Comment #3 from Jakub Jelinek --- Reduced testcase: long v; template struct A; template , typename =3D C> class B; template <> struct A { static int foo(char *s, const char *t, long n) { return __builtin_memcmp(= s, t, n); } }; template struct B { long b; B(const C *); C *bar() const; constexpr unsigned long baz(const C *, unsigned long, unsigned long) const noexcept; void baz() { C c; baz(&c, 0, v); } }; template constexpr unsigned long B::baz(const C *s, unsigned long, unsigned long n) const noexcept { C *x =3D bar(); if (!x) return b; D::foo(x, s, n); return 0; } namespace { struct F { virtual ~F() {} }; struct F2 { virtual void foo(B) const; }; struct F3 : F, F2 { void foo(B s) const { s.baz(); } } f; } int main() { F *p; dynamic_cast(p)->foo(""); } Started with r14-2152-g7198573f44fb579843bff8deda695107858d8cff=