From patchwork Tue Mar 14 02:03:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 69243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1514542wrd; Mon, 13 Mar 2023 19:04:01 -0700 (PDT) X-Google-Smtp-Source: AK7set8qKHivvMJHWlbxtohovJHWBIXIG8TUm5rNeQntl8npm4Kx8Wl5msIFpbAUeECTC6B9ti4U X-Received: by 2002:a50:fb85:0:b0:4be:b39b:ea8f with SMTP id e5-20020a50fb85000000b004beb39bea8fmr32686529edq.2.1678759441478; Mon, 13 Mar 2023 19:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678759441; cv=none; d=google.com; s=arc-20160816; b=ZTLUe1tcAARXQWwam0js7x5KKmPuW+tkVpXMCM+eWQv59kZDNhbkPyu4Cs7zDB9Qie lWxM1tYrCOYlCWoMQA6dP+3uB/jEEKIuXFUU2PpaDGlvriBHNkvizao0L6NcclGZSA9V uWXsE45qumj3EcRTMLovpZuykynGRBBar9qDR2ae6IW4l8crF4wzVrqUiNRcp7P01+7w 7mTSq27EM/7yFbyYN+HpXq3IBFNNfMrPwyyQj1VfETF/GF7aajfEE7HsavAs8/xacZz0 oNCk4hvWLGWAWjaOgOc5MdK7laVHijNuXznXUmlxh4S3i+rYIUFs2ssXQnEqP815bb83 Rfeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=V5TpJnH5cZUOW7S9x+YbKBVcpprB7h3phZUTQuhQ5dc=; b=GrTNYWqndyKX4pBRldqdvPNdaAgVr6u8fEnaClMSeypSK7FMEzb4yaO/jTiJbD1eHy RAZRlDyn8x+yD/XOClIhWewVedbrYQ48zD/RRBvg58uuHsObtJV5QVvsr+RoCGLu2iKc TrYlVNgjKSp4uKSb+/FcykJmqHzGxQS6MLnScjbrKLep2DWymyjUQTfmoal39I2yvmAT cmUR3d8FaZPNIvAMRGRqExJM7sIw/LEWuGZHQAvjZZTTgPHybVKkQB5axpNzVBJtT5xl 1ZRaFCLZ87qQrQJ/Wttqv8xDFfF6b0FcXiFn60BBHqXRQE7U9k/xzDGv+zvrHB6c3RSx m2Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=YFgNRF3l; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c10-20020aa7df0a000000b004fcbdc5577fsi1215558edy.59.2023.03.13.19.04.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 19:04:01 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=YFgNRF3l; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83F3138582AB for ; Tue, 14 Mar 2023 02:03:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83F3138582AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678759439; bh=V5TpJnH5cZUOW7S9x+YbKBVcpprB7h3phZUTQuhQ5dc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YFgNRF3lJUjBTTCRFhmv76KzBeSiQ/tsgXSostl6B0OWYi1x0G4tYYpJVd9p2amw4 tgjQKf6y+8bv2FDWoP/JMztYc4M3tBqSnD4iisXBy8n5+DAlbHiLBBZFAuIPLQF7+l NivcngICBIlaRIx0HshyMLHTx7h8fEQewlD+1CaA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 864F53858421 for ; Tue, 14 Mar 2023 02:03:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 864F53858421 Received: by mail-pl1-x62b.google.com with SMTP id ix20so8535223plb.3 for ; Mon, 13 Mar 2023 19:03:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678759429; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V5TpJnH5cZUOW7S9x+YbKBVcpprB7h3phZUTQuhQ5dc=; b=JbKTOaeEhcfP+VynJHRjnTIbb2DrXqQKWFViRTtZAbud82da5WKxhJo1agx4NZLT0C K9hkI5wxc/nSEAEnf4nlxueZCEwd2O/kJ4bPxD4Q72oeQxGoK8KEyNlHeuR0xxgv0sJT U7jssLWXSF57nuV3Ao0irjx0KI4orENnddpl3qfbaECKSc1zc/8yCOByIhdB5js+qALr S/xxMuDGg5CBj5IaxCdTa8uvGXG+0op9y3XYmG0L0S9CiGAwvOEFAtI7dTXcel8qvZUC SHB3/C7s4D1WiZ/+el4h0hHe6Gvi41LGHIp/XCwvrRx6uGiIm1hBB0dXOy7MWauLrioq F6IA== X-Gm-Message-State: AO0yUKWTSzKOWPttx7r5xQEwnfVoOFFsDKrQlRi/z0G0yffhVl63vl0N SfpBItuyBoC4f30mvDt8HHdjmVOcaGc= X-Received: by 2002:a05:6a20:548a:b0:cc:d891:b2b1 with SMTP id i10-20020a056a20548a00b000ccd891b2b1mr48063182pzk.35.1678759429224; Mon, 13 Mar 2023 19:03:49 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id j9-20020aa79289000000b00594235980e4sm333554pfa.181.2023.03.13.19.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 19:03:48 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id D28101142C71; Tue, 14 Mar 2023 12:33:46 +1030 (ACDT) Date: Tue, 14 Mar 2023 12:33:46 +1030 To: binutils@sourceware.org Subject: gas/ecoff.c: don't use zero struct copies to init Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3035.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760306860557225030?= X-GMAIL-MSGID: =?utf-8?q?1760306860557225030?= It might have made sense once upon a time, but doesn't nowadays when compilers expand memset inline. * ecoff.c (add_aux_sym_tir, allocate_scope, allocate_vlinks), (allocate_shash, allocate_thash, allocate_tag, allocate_forward), (allocate_thead, allocate_lineno_list): Use memset rather than copying zero struct. diff --git a/gas/ecoff.c b/gas/ecoff.c index ecafe270dd3..1c01911f55c 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -1850,7 +1850,6 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ { varray_t *vp; aux_t *aux_ptr; - static AUXU init_aux; symint_t ret; int i; AUXU aux; @@ -1860,7 +1859,7 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ vp = &cur_file_ptr->aux_syms; - aux = init_aux; + memset (&aux, 0, sizeof (aux)); aux.ti.bt = (int) t->basic_type; aux.ti.continued = 0; aux.ti.fBitfield = t->bitfield; @@ -4808,7 +4807,6 @@ static scope_t * allocate_scope (void) { scope_t *ptr; - static scope_t initial_scope; #ifndef MALLOC_CHECK @@ -4838,7 +4836,7 @@ allocate_scope (void) #endif alloc_counts[(int) alloc_type_scope].total_alloc++; - *ptr = initial_scope; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -4863,7 +4861,6 @@ static vlinks_t * allocate_vlinks (void) { vlinks_t *ptr; - static vlinks_t initial_vlinks; #ifndef MALLOC_CHECK @@ -4887,7 +4884,7 @@ allocate_vlinks (void) #endif alloc_counts[(int) alloc_type_vlinks].total_alloc++; - *ptr = initial_vlinks; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -4897,7 +4894,6 @@ static shash_t * allocate_shash (void) { shash_t *ptr; - static shash_t initial_shash; #ifndef MALLOC_CHECK @@ -4921,7 +4917,7 @@ allocate_shash (void) #endif alloc_counts[(int) alloc_type_shash].total_alloc++; - *ptr = initial_shash; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -4931,7 +4927,6 @@ static thash_t * allocate_thash (void) { thash_t *ptr; - static thash_t initial_thash; #ifndef MALLOC_CHECK @@ -4955,7 +4950,7 @@ allocate_thash (void) #endif alloc_counts[(int) alloc_type_thash].total_alloc++; - *ptr = initial_thash; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -4965,7 +4960,6 @@ static tag_t * allocate_tag (void) { tag_t *ptr; - static tag_t initial_tag; #ifndef MALLOC_CHECK @@ -4995,7 +4989,7 @@ allocate_tag (void) #endif alloc_counts[(int) alloc_type_tag].total_alloc++; - *ptr = initial_tag; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -5020,7 +5014,6 @@ static forward_t * allocate_forward (void) { forward_t *ptr; - static forward_t initial_forward; #ifndef MALLOC_CHECK @@ -5044,7 +5037,7 @@ allocate_forward (void) #endif alloc_counts[(int) alloc_type_forward].total_alloc++; - *ptr = initial_forward; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -5054,7 +5047,6 @@ static thead_t * allocate_thead (void) { thead_t *ptr; - static thead_t initial_thead; #ifndef MALLOC_CHECK @@ -5084,7 +5076,7 @@ allocate_thead (void) #endif alloc_counts[(int) alloc_type_thead].total_alloc++; - *ptr = initial_thead; + memset (ptr, 0, sizeof (*ptr)); return ptr; } @@ -5107,7 +5099,6 @@ static lineno_list_t * allocate_lineno_list (void) { lineno_list_t *ptr; - static lineno_list_t initial_lineno_list; #ifndef MALLOC_CHECK @@ -5131,7 +5122,7 @@ allocate_lineno_list (void) #endif alloc_counts[(int) alloc_type_lineno].total_alloc++; - *ptr = initial_lineno_list; + memset (ptr, 0, sizeof (*ptr)); return ptr; }