From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8A6CA3858406; Wed, 12 Jan 2022 16:39:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A6CA3858406 From: "jjlindal at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103993] New: Incorrect error generated by mismatched-new-delete Date: Wed, 12 Jan 2022 16:39:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jjlindal at gmail 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 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: Wed, 12 Jan 2022 16:39:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103993 Bug ID: 103993 Summary: Incorrect error generated by mismatched-new-delete Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jjlindal at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=3Dnvptx-none OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=3Dc,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=3D/usr --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-bugurl=3Dhttp://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=3Dposix --enable-checking=3Drelease --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=3Dgnu --enable-plugin --enable-initfini-array --with-isl=3D/builddir/build/BUILD/gcc-11.2.1-20211203/obj-x86_64-redhat-li= nux/isl-install --enable-offload-targets=3Dnvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=3Dgeneric --with-arch_32=3Di686 --build=3Dx86_64-redhat-linux --with-build-config=3Dbootstrap-lto --enable-link-serialization=3D1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.1 20211203 (Red Hat 11.2.1-7) (GCC)=20 $ g++ -std=3Dc++17 -D_J_HAS_PROC -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_XFT_NO_COMPAT_ -I/usr/include/freetype2 -D_J_UNIX -D_J_HAS_XINERAMA -Wa= ll -Werror -I../include -I/usr/include/freetype2 -I/usr/include/libxml2 -O2 -= c -o code/JSimpleProcess.o code/JSimpleProcess.cpp -save-temps In file included from /usr/local/include/ace/Svc_Handler.h:344, from ../include/jx-af/jcore/JNetworkProtocolBase.h:11, from ../include/jx-af/jcore/JMessageProtocol.h:11, from ../include/jx-af/jcore/JSimpleProcess.h:16, from code/JSimpleProcess.cpp:18: In static member function =E2=80=98static void ACE_Svc_Handler::operator delete(void*) [with PEER_STREAM =3D ACE_LSOCK_Strea= m; SYNCH_TRAITS =3D ACE_MT_SYNCH]=E2=80=99, inlined from =E2=80=98JSimpleProcess::JSimpleProcess(pid_t, int, bool)= =E2=80=99 at code/JSimpleProcess.cpp:322:30: /usr/local/include/ace/Svc_Handler.cpp:117:3: error: =E2=80=98void operator= delete [](void*)=E2=80=99 called on pointer returned from a mismatched allocation = function [-Werror=3Dmismatched-new-delete] 117 | ::delete [] static_cast (obj); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ code/JSimpleProcess.cpp: In constructor =E2=80=98JSimpleProcess::JSimplePro= cess(pid_t, int, bool)=E2=80=99: code/JSimpleProcess.cpp:322:37: note: returned from =E2=80=98static void* ACE_Svc_Handler::operator new(size_t) [with PEER_STREAM =3D ACE_LSOCK_Stream; SYNCH_TRAITS =3D ACE_MT_SYNCH]=E2=80=99 322 | itsLink =3D new ProcessLink(fd); | ^ In file included from /usr/local/include/ace/Svc_Handler.h:344, from ../include/jx-af/jcore/JNetworkProtocolBase.h:11, from ../include/jx-af/jcore/JMessageProtocol.h:11, from ../include/jx-af/jcore/JSimpleProcess.h:16, from code/JSimpleProcess.cpp:18: In static member function =E2=80=98static void ACE_Svc_Handler::operator delete(void*) [with PEER_STREAM =3D ACE_LSOCK_Strea= m; SYNCH_TRAITS =3D ACE_MT_SYNCH]=E2=80=99, inlined from =E2=80=98JSimpleProcess::JSimpleProcess(pid_t, int, bool)= =E2=80=99 at code/JSimpleProcess.cpp:322:30: /usr/local/include/ace/Svc_Handler.cpp:117:3: error: =E2=80=98void operator= delete [](void*)=E2=80=99 called on pointer returned from a mismatched allocation = function [-Werror=3Dmismatched-new-delete] 117 | ::delete [] static_cast (obj); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ code/JSimpleProcess.cpp: In constructor =E2=80=98JSimpleProcess::JSimplePro= cess(pid_t, int, bool)=E2=80=99: code/JSimpleProcess.cpp:322:37: note: returned from =E2=80=98static void* ACE_Svc_Handler::operator new(size_t) [with PEER_STREAM =3D ACE_LSOCK_Stream; SYNCH_TRAITS =3D ACE_MT_SYNCH]=E2=80=99 322 | itsLink =3D new ProcessLink(fd); | ^ cc1plus: all warnings being treated as errors=