From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BC6D93858404 for ; Thu, 8 Sep 2022 16:23:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC6D93858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662654214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fgv5mP56H9DR4r10xOAT3ZxaHpecOj8PLetA+l+ZHqQ=; b=MqcpuBoy7HpjWCd6T2zzZDp/h1lebs87NfH4M0pUAAPPulBc+tN0U+v9+RbHKosR1snfVH QYhS9/DUfvcEONOT0zQK1EPn2ugNDnq3OExYQVMs/TDRxBSOTWyEMOpPKLoaNwk2ZcYlhy kl3fV2Ze/0XkLOuyH63i3QCefDaDPjQ= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-216-Waom5K_-NQyGJY4skZ2x0w-1; Thu, 08 Sep 2022 12:23:33 -0400 X-MC-Unique: Waom5K_-NQyGJY4skZ2x0w-1 Received: by mail-qk1-f200.google.com with SMTP id az11-20020a05620a170b00b006bc374c71e8so15118224qkb.17 for ; Thu, 08 Sep 2022 09:23:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=fgv5mP56H9DR4r10xOAT3ZxaHpecOj8PLetA+l+ZHqQ=; b=SVRuHGeo2g9/OVxZXgJgATiybtwzs/L+UFBeOdFuc20833azCYxWFPSaJsxVepbgiS Ud186v6uvy9YjTzZWodzoOWoL/sOLK4NxNxzXob2XniTRc6iASMhPMkbhkPGs/WgkFm/ Vw42QmwpoMtHtMg1i68W9jFgqVzYjVzeVWK025FrX1nsfzFKLCQ6lXMBcwLni+aPmcHl 8Uy0KofgFmX58F+/okEk0UnnckGQTIFXFC+rSF+5Uon+rAhQUmoTBzfUB8qYY/QyXziK GYKRxnUhSCBFvnYIS85jEjU3FJZTj/6AjL1aUHDWjqyVFqASRvv3P7wdW6YajmHzLiYd NaKQ== X-Gm-Message-State: ACgBeo26MJ8zuruL2qZ7J+aIE575qz1fb/WJu7jiwsNGNvDu9+BYgQJy buIv79iEyX/KqG9AGgdS9PaOVwU1LZdBwwGVz+rtOw8Qt7M3+Yzk+33zJHa49RvaSGVF43PyGRT pNFQ/nc+9p5KXOdeXfw== X-Received: by 2002:a05:620a:271f:b0:6b9:3b62:c67e with SMTP id b31-20020a05620a271f00b006b93b62c67emr7116204qkp.164.1662654212830; Thu, 08 Sep 2022 09:23:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4u/J26wUrFGLa9iqdP/aX/CDNoCujTjPoH6LCkxWRw8Fk7SkGhQWSFrdOI2gg8cfCg1DA3uA== X-Received: by 2002:a05:620a:271f:b0:6b9:3b62:c67e with SMTP id b31-20020a05620a271f00b006b93b62c67emr7116187qkp.164.1662654212559; Thu, 08 Sep 2022 09:23:32 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id h12-20020a05620a400c00b006cbd92ca141sm1096978qko.133.2022.09.08.09.23.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 09:23:32 -0700 (PDT) Message-ID: Date: Thu, 8 Sep 2022 12:23:30 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] optc-save-gen.awk: adjust generated array compare To: Chung-Lin Tang , gcc-patches Cc: Sandra Loosemore , Joseph Myers , =?UTF-8?Q?Martin_Li=c5=a1ka?= References: <56951572-c9b4-af2d-0e8b-9d47b87ba313@codesourcery.com> From: Jason Merrill In-Reply-To: <56951572-c9b4-af2d-0e8b-9d47b87ba313@codesourcery.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_ASCII_DIVIDERS,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,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 List-Id: On 9/8/22 11:29, Chung-Lin Tang wrote: > Hi Joseph, > Jan-Benedict reported a build-bot error for the nios2 port under --enable-werror-always: > > options-save.cc: In function 'bool cl_target_option_eq(const cl_target_option*, const cl_target_option*)': > options-save.cc:9291:38: error: comparison between two arrays [-Werror=array-compare] > 9291 | if (ptr1->saved_custom_code_status != ptr2->saved_custom_code_status > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > options-save.cc:9291:38: note: use unary '+' which decays operands to pointers or '&'component_ref' not supported by dump_decl[0] != &'component_ref' not supported by dump_decl[0]' to compare the addresses > options-save.cc:9294:37: error: comparison between two arrays [-Werror=array-compare] > 9294 | if (ptr1->saved_custom_code_index != ptr2->saved_custom_code_index > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ... > > This is due to an array-typed TargetSave state in config/nios2/nios2.opt: > ... > TargetSave > enum nios2_ccs_code saved_custom_code_status[256] > > TargetSave > int saved_custom_code_index[256] > ... > > > This patch adjusts the generated array state compare from 'ptr1->array' into '&ptr1->array[0]' in gcc/optc-save-gen.awk, > seems sufficient to pass the tougher checks. > > Tested by ensuring the compiler builds, which should be sufficient here. > Okay to commit to mainline? Martin added the array support in r219636, any thoughts? It seems to me that the warning is pointing out that comparing the address of the array is nonsensical, and we should remove it and just have the memcmp. > Thanks, > Chung-Lin > > * optc-save-gen.awk: Adjust array compare to use '&ptr->name[0]' > instead of 'ptr->name'.