Message ID | ZXlqLxcI69T1ypbA@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7624249dys; Wed, 13 Dec 2023 00:24:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IETeEq7ol2skei5EJ87abJEoxEn8nC5i0jzIG+FV1M9nTA3nHJSIUW6oAUuhh/kYeHZHwQl X-Received: by 2002:ad4:4182:0:b0:67a:c933:bc37 with SMTP id e2-20020ad44182000000b0067ac933bc37mr9075130qvp.59.1702455887514; Wed, 13 Dec 2023 00:24:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702455887; cv=pass; d=google.com; s=arc-20160816; b=wHEVbbT8gnuOz+46FSh5eGaehLJrnJbQSyfTrceLTxVuwyj+lA/AxTr0F8llzUWzUo jdUNFBAyj3v3Qe5vjCtAINTS5Bo/iENuMSh9gl8rII+QaBeJaTWk5zhDUCEnUjqfbtgI xUPy6TK2F021tjPm2L8qU8lNJICqNb2vXnE7YAivOYruYmndSGxKvCgX9oDN2Cdy7/Kr MUWSHIu9nku59ayJth6PFTSKppTBFkRcVi/RF+woWlYCD9gA5oDZFbhic3WevNuII6z7 8Z6FRU3fa8RTsO95Z3tB4zgcjlRcLRO/xMsFdMzIDz66ey8pFWnGQnezvt3N0ZPIDsEB n2rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=8nDSCuaIrCizYafB5UtJngcw2/sy8M5jA56WsJaJSqM=; fh=eM2nYbNDZ6Theupq9WaNJQV2QgkrsvQk+3X75erbI8c=; b=qTj5UG3ph0njP6yc/Vni/W66xc1dQBq9z4ieOcmivrZzMrFRUMcgFkczw1s35e1v75 Kxjp7iOXffkvRIKGCrcG6Hdz+nHaHC1d394F9C1JMbZbyOkcIQBm01J7z+q5WYyKq1mJ EyRqz3LqvJmVaBa5gk2Lp47solyCzi1NrMD53AbhVDv6biTMgixG9gRYjDEODNz2a/dy DZEgOVK3f4pNfjEJ2/3Tb8NQAauCNRfr2skoa97lz67ovO0J6Dk4lo0iiN9nYt4WevDE C3/4OwD9bVo7j5PNmcXH1k44RbvSBNH09ukSv9lT/q+h+DSoH9UPuuCT5XSeSrMQvUiM irpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AiDsbvqH; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bs33-20020a05620a472100b0077d7db62ccfsi12746692qkb.231.2023.12.13.00.24.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 00:24:47 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AiDsbvqH; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38648385C420 for <ouuuleilei@gmail.com>; Wed, 13 Dec 2023 08:24:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 2983538582A2 for <gcc-patches@gcc.gnu.org>; Wed, 13 Dec 2023 08:24:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2983538582A2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2983538582A2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702455864; cv=none; b=t1Gmd7mtdUDPWepq0zD1PJ9sAGmfPRfIxnY24w6ll3UKZrxtJ62fKaIt+vv7/nXt8fKYt3lX3q1F/ROZx3OJBJB+Ik/5CNU/IIMhDD62hNGLijG+zf5Lk5paHikfmxF3Pk12YUUCmVZVA9juNJ6LRoaQ1t0Y88KLToeM8ykT0cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702455864; c=relaxed/simple; bh=nJkcsLSNh6tDqMyCWbg/OnKUEx/zc9gcGq+s9xRMmts=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=RY97rvNGn0frqYsq5uGr/Mz0pmLqf3gSO9jtoGH1yHrC9yrBLh2Sg084oFu4o2qPs/5K0T30uFdjYxyrfI8LVHSiwwZ9LsFG3EhIh4XcVkWPhdx1pSJ1/lzePRZ2uhxumfATQjIX+k11Tx3/5Pzm2mJ0trG/ImbD3gwjZmGgnN0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702455861; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=8nDSCuaIrCizYafB5UtJngcw2/sy8M5jA56WsJaJSqM=; b=AiDsbvqHcDxTvaUA2U1P3XRYSTuHbdy+MlpKaPfQsBq4wFz5AQFJqfrcDeDE3g/1vdi0Q+ CPf5UTvGpkIlLq2LQAL5pwFzuVyTvRkK+YNcdtryeijiFfk6EkMQdSH3/e+EFBA6v5u6eU 2g8dTiYApT90w1hIFZCxeGvqjsWHwF8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-aXV2Ltq2PK2u2e3suYBxlg-1; Wed, 13 Dec 2023 03:24:20 -0500 X-MC-Unique: aXV2Ltq2PK2u2e3suYBxlg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C06E5101CFBB; Wed, 13 Dec 2023 08:24:19 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A25840C6EB9; Wed, 13 Dec 2023 08:24:19 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3BD8OGed2489534 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 09:24:17 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3BD8OFbR2489533; Wed, 13 Dec 2023 09:24:15 +0100 Date: Wed, 13 Dec 2023 09:24:15 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de>, Richard Sandiford <richard.sandiford@arm.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] attribs: Fix valgrind failures on -Wno-attributes* tests [PR112953] Message-ID: <ZXlqLxcI69T1ypbA@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785154384842229271 X-GMAIL-MSGID: 1785154384842229271 |
Series |
attribs: Fix valgrind failures on -Wno-attributes* tests [PR112953]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Dec. 13, 2023, 8:24 a.m. UTC
Hi! The r14-6076 change changed the allocation of attribute tables from table = new attribute_spec[2]; to table = new attribute_spec { ... }; with ignored_attributes_table.safe_push (table); later in both cases, but didn't change the corresponding delete in free_attr_data, which means valgrind is unhappy about that: FAIL: c-c++-common/Wno-attributes-2.c -Wc++-compat (test for excess errors) Excess errors: ==974681== Mismatched free() / delete / delete [] ==974681== at 0x484965B: operator delete[](void*) (vg_replace_malloc.c:1103) ==974681== by 0x707434: free_attr_data() (attribs.cc:318) ==974681== by 0xCFF8A4: compile_file() (toplev.cc:454) ==974681== by 0x704D23: do_compile (toplev.cc:2150) ==974681== by 0x704D23: toplev::main(int, char**) (toplev.cc:2306) ==974681== by 0x7064BA: main (main.cc:39) ==974681== Address 0x51dffa0 is 0 bytes inside a block of size 40 alloc'd ==974681== at 0x4845FF5: operator new(unsigned long) (vg_replace_malloc.c:422) ==974681== by 0x70A040: handle_ignored_attributes_option(vec<char*, va_heap, vl_ptr>*) (attribs.cc:301) ==974681== by 0x7FA089: handle_pragma_diagnostic_impl<false, false> (c-pragma.cc:934) ==974681== by 0x7FA089: handle_pragma_diagnostic(cpp_reader*) (c-pragma.cc:1028) ==974681== by 0x75814F: c_parser_pragma(c_parser*, pragma_context, bool*) (c-parser.cc:14707) ==974681== by 0x784A85: c_parser_external_declaration(c_parser*) (c-parser.cc:2027) ==974681== by 0x785223: c_parser_translation_unit (c-parser.cc:1900) ==974681== by 0x785223: c_parse_file() (c-parser.cc:26713) ==974681== by 0x7F6331: c_common_parse_file() (c-opts.cc:1301) ==974681== by 0xCFF87D: compile_file() (toplev.cc:446) ==974681== by 0x704D23: do_compile (toplev.cc:2150) ==974681== by 0x704D23: toplev::main(int, char**) (toplev.cc:2306) ==974681== by 0x7064BA: main (main.cc:39) Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-12-13 Jakub Jelinek <jakub@redhat.com> PR middle-end/112953 * attribs.cc (free_attr_data): Use delete x rather than delete[] x. Jakub
Comments
On Wed, 13 Dec 2023, Jakub Jelinek wrote: > Hi! > > The r14-6076 change changed the allocation of attribute tables from > table = new attribute_spec[2]; > to > table = new attribute_spec { ... }; > with > ignored_attributes_table.safe_push (table); > later in both cases, but didn't change the corresponding delete in > free_attr_data, which means valgrind is unhappy about that: > FAIL: c-c++-common/Wno-attributes-2.c -Wc++-compat (test for excess errors) > Excess errors: > ==974681== Mismatched free() / delete / delete [] > ==974681== at 0x484965B: operator delete[](void*) (vg_replace_malloc.c:1103) > ==974681== by 0x707434: free_attr_data() (attribs.cc:318) > ==974681== by 0xCFF8A4: compile_file() (toplev.cc:454) > ==974681== by 0x704D23: do_compile (toplev.cc:2150) > ==974681== by 0x704D23: toplev::main(int, char**) (toplev.cc:2306) > ==974681== by 0x7064BA: main (main.cc:39) > ==974681== Address 0x51dffa0 is 0 bytes inside a block of size 40 alloc'd > ==974681== at 0x4845FF5: operator new(unsigned long) (vg_replace_malloc.c:422) > ==974681== by 0x70A040: handle_ignored_attributes_option(vec<char*, va_heap, vl_ptr>*) (attribs.cc:301) > ==974681== by 0x7FA089: handle_pragma_diagnostic_impl<false, false> (c-pragma.cc:934) > ==974681== by 0x7FA089: handle_pragma_diagnostic(cpp_reader*) (c-pragma.cc:1028) > ==974681== by 0x75814F: c_parser_pragma(c_parser*, pragma_context, bool*) (c-parser.cc:14707) > ==974681== by 0x784A85: c_parser_external_declaration(c_parser*) (c-parser.cc:2027) > ==974681== by 0x785223: c_parser_translation_unit (c-parser.cc:1900) > ==974681== by 0x785223: c_parse_file() (c-parser.cc:26713) > ==974681== by 0x7F6331: c_common_parse_file() (c-opts.cc:1301) > ==974681== by 0xCFF87D: compile_file() (toplev.cc:446) > ==974681== by 0x704D23: do_compile (toplev.cc:2150) > ==974681== by 0x704D23: toplev::main(int, char**) (toplev.cc:2306) > ==974681== by 0x7064BA: main (main.cc:39) > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? OK. > 2023-12-13 Jakub Jelinek <jakub@redhat.com> > > PR middle-end/112953 > * attribs.cc (free_attr_data): Use delete x rather than delete[] x. > > --- gcc/attribs.cc.jj 2023-12-09 10:19:57.809813529 +0100 > +++ gcc/attribs.cc 2023-12-11 09:55:28.894461698 +0100 > @@ -315,7 +315,7 @@ void > free_attr_data () > { > for (auto x : ignored_attributes_table) > - delete[] x; > + delete x; > ignored_attributes_table.release (); > } > > > Jakub > >
--- gcc/attribs.cc.jj 2023-12-09 10:19:57.809813529 +0100 +++ gcc/attribs.cc 2023-12-11 09:55:28.894461698 +0100 @@ -315,7 +315,7 @@ void free_attr_data () { for (auto x : ignored_attributes_table) - delete[] x; + delete x; ignored_attributes_table.release (); }