From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97F5A3858D33; Thu, 6 Apr 2023 19:00:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97F5A3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680807654; bh=ScTIq45aPXZ6ZOHR5TYUFYzLgd06hgLAHzF8c6KHWeo=; h=From:To:Subject:Date:From; b=YzYAkPRz2ZlcIEyZAP20iHgVfu4PSZWKqPSnlD8smVjAQrZoZglCu9SYTDHBiNzyf YNKjsOWpOwGqLqsI/vnj3Ur7K4CfEEImDW2I6SOVS+Vqgob/y2/NZRRcP0OanwEk8Z iwpA/5VW3nK8L1/8ry6fWRfDcmQt21sztuj8BNNI= From: "hiraditya at msn dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109442] New: Dead local copy of std::vector not removed from function Date: Thu, 06 Apr 2023 19:00:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hiraditya at msn dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109442 Bug ID: 109442 Summary: Dead local copy of std::vector not removed from function Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: hiraditya at msn dot com Target Milestone: --- T vat1(std::vector v1) { auto v =3D v1; return 10; } g++ -O3 -std=3Dc++20 -fno-exceptions vat1(std::vector >): mov rax, QWORD PTR [rdi+8] sub rax, QWORD PTR [rdi] je .L11 push rbp mov rbp, rax movabs rax, 9223372036854775804 push rbx sub rsp, 8 cmp rax, rbp jb .L15 mov rbx, rdi mov rdi, rbp call operator new(unsigned long) mov rsi, QWORD PTR [rbx] mov rdx, QWORD PTR [rbx+8] mov rdi, rax sub rdx, rsi cmp rdx, 4 jle .L16 call memmove mov rdi, rax .L6: mov rsi, rbp call operator delete(void*, unsigned long) add rsp, 8 mov eax, 10 pop rbx pop rbp ret .L11: mov eax, 10 ret .L15: call std::__throw_bad_array_new_length() .L16: jne .L6 mov eax, DWORD PTR [rsi] mov DWORD PTR [rdi], eax jmp .L6=