Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3866020imm; Mon, 8 Oct 2018 10:47:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV62YG/jXKgAeaipgH9tkO4hO1fVgowNi5aLUQHgef1b3eslhFf2XuTrH9RB3pDXcXU60Rtin X-Received: by 2002:a17:902:d20a:: with SMTP id t10-v6mr25073639ply.256.1539020824578; Mon, 08 Oct 2018 10:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539020824; cv=none; d=google.com; s=arc-20160816; b=Gqz8IcQs8OVw0mBjY3VkjWLc520/ZyGjzs+FdxKJf5CG1fQyIn91rpP8Q0KAdaBCgp BMoV/NXl2/dcMZHeSwqG4hO/fA2IfeMQnoLpXLHAEjs4wJw4VP+/uxDvbXGQd5E1JVEI kxJ2Ka2+SxONqeYDBkPxM1+o6vxBJ2S+IDMg2Mi70PGx+F/BBJXZlMShOBRrWyiO5Im/ 4xJkCsM8HDp+6iKaK+gVdT/8jXEqTWXTCB/AHIikjgzhTFvxMf+ju4a+1iA+EYS1gJUQ b29gRr7DN7ZhKwC+msclTSZw03v6kx4zXRDjsSZCE/uAxcjCxTVl9KCLsGPU1wT5Q0lU tV8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZY8bZ2xBQFg51chSva81weSb+0yW1O0m/mdCnEL7dJo=; b=WoNmjeDDvY4vmr4rtbJHrvU5Oek2YqMNKsv1auMO55ut/EARdbKg7npnAG1KYvDB9X luVCsopKVHUCBu5LhKHOY6ol7I6O4QAQeVcmnt47TKUNVYwB4eBnnGNVWEYZxLzF2gv3 QS9438JJInOg8eISwAIiSpBiz13GamqDsKEovdATzH7uAsiYxi+tvfp7no4DemBVtKZT ojSF83r212f0AsvxYEdJkGAXffer3M/lOiBw40mcXtIoCfGR/kI7HZHK9o8LHTiu4bf0 4MCu3R+7iGo3AnX/8qQzgOqmu0cnYDWm0mSrVSqdj1BlDBnk3qZuvDrXp3KMoLM+Fski 67cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=l4PIyY9i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62-v6si9809662plf.288.2018.10.08.10.46.49; Mon, 08 Oct 2018 10:47:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=l4PIyY9i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726569AbeJIA7U (ORCPT + 99 others); Mon, 8 Oct 2018 20:59:20 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39653 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbeJIA7U (ORCPT ); Mon, 8 Oct 2018 20:59:20 -0400 Received: by mail-pf1-f195.google.com with SMTP id c25-v6so8389694pfe.6 for ; Mon, 08 Oct 2018 10:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZY8bZ2xBQFg51chSva81weSb+0yW1O0m/mdCnEL7dJo=; b=l4PIyY9iJtb8ufEdPEpDpVxo0doPZaj4jEG4mIuYY78gjuje53dZJO3t7VpPaOiHiX 9ARKDwciWtOc/kCMsCFPOe+ritrjl66GZjOhlP8ZIjQGIMvr7i1pIb88D+voFpYW2sJg PRmOVRBt0JgYPtM/sdWVAlLxwP7Kuc3T5eMhKWMvOGdfi3Kkwol2cgStNiJZnaiNXfan qKByDKfd1SAJNYqNmpOnZpg/OM/vlMILP6LOkznRMBAA0pygI66e8Dto/LuRDfzmGmQa +PCrbubvjzypwr/x4Wu7Dln6Plu53pImdysyVlQSKlwetVtjHGrPtM6Yp4rs4QKQhFRr KeMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ZY8bZ2xBQFg51chSva81weSb+0yW1O0m/mdCnEL7dJo=; b=Ulvmw227KZjndDZRH7pE8JdZM728TKe9Fm1/eXICBFHPf7hsViwKi3dAVXO/vMp9ie 3bkw0pq7w8O9v1q6+fkx/3sYYzgbRMdQfwpZIUXPabup7NhrHJQhLLHVpRxVZhv638Ib ui51JNfb5bYhOSIoc2QUp3M8/n9VPjUm07vbNvxJ7imKRokYLP7UmOKVgfldR5aDguWO CMMzc063kpXX6azp2CoQ9BBS5Ke8cpOL1pI4gOhBByyYTXVRKCBwpMpyWCu5PRempGXj n2YNdIuc7qBWaQcU2Gj0PPlbVFcZ/RQNJ+IjXTjadrhRAnkvKIJfhqI7d7gjUEwDylaV 1zgw== X-Gm-Message-State: ABuFfohjNZv/SDHtbyu1y4GgCOcZbBUvhoCC2U4eW277WztWYM1O0lQd 60VNhMWt+20LmS2/U73NDDc= X-Received: by 2002:a62:7501:: with SMTP id q1-v6mr25982302pfc.225.1539020789909; Mon, 08 Oct 2018 10:46:29 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id j15-v6sm21227884pfn.52.2018.10.08.10.46.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 10:46:29 -0700 (PDT) Date: Mon, 8 Oct 2018 10:46:28 -0700 From: Guenter Roeck To: "Koenig, Christian" Cc: "Deucher, Alexander" , Peng Hao , "airlied@linux.ie" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" Subject: Re: [PATCH] amdgpu/gmc : fix compile warning Message-ID: <20181008174628.GB11442@roeck-us.net> References: <1536919552-116245-1-git-send-email-peng.hao2@zte.com.cn> <20181004185237.GA20667@roeck-us.net> <022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com> <4772f72c-6018-3556-6324-5f49faa00073@roeck-us.net> <4da23fcb-4a94-2695-ad80-929025e84bd2@gmail.com> <74078dc6-ef08-586b-fd58-51eb2c0b5060@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 08, 2018 at 05:22:24PM +0000, Koenig, Christian wrote: > Am 08.10.2018 um 17:57 schrieb Deucher, Alexander: > >>>> One thing I found missing in the discussion was the reference to the > >>>> C standard. > >>>> The C99 standard states in section 6.7.8 (Initialization) clause 19: > >>>> "... all > >>>> subobjects that are not initialized explicitly shall be initialized > >>>> implicitly the same as objects that have static storage duration". > >>>> Clause 21 makes further reference to partial initialization, > >>>> suggesting the same. Various online resources, including the gcc > >>>> documentation, all state the same. I don't find any reference to a > >>>> partial initialization which would leave members of a structure > >>>> undefined. It would be interesting for me to understand how and why > >>>> this does not apply here. > >>>> > >>>> In this context, it is interesting that the other 48 instances of the > >>>> { { 0 } } initialization in the same driver don't raise similar > >>>> concerns, nor seemed to have caused any operational problems. > >>> Feel free to provide patches to replace those with memset(). > >>> > >> Not me. As I see it, the problem, if it exists, would be a violation of the C > >> standard. I don't believe hacking around bad C compilers. I would rather > >> blacklist such compilers. > > Well then you would need to blacklist basically all gcc variants of the > last decade or so. > > Initializing only known members of structures is a perfectly valid > optimization and well known issue when you then compare the structure > with memcpy() or use the bytes for hashing or something similar. > Isn't that about padding ? That is a completely different issue. Guenter