Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2925305imm; Fri, 19 Oct 2018 01:58:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV61nwnHE5GwFcuo9lJVzfCVmOxtWJwygdkvI2qw+DTGPJ5ajnSVU9P2ntPwYg4o0xhktJAK7 X-Received: by 2002:a62:64d5:: with SMTP id y204-v6mr33619012pfb.187.1539939506212; Fri, 19 Oct 2018 01:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539939506; cv=none; d=google.com; s=arc-20160816; b=siY61CfQF4hBDnWDsmJ54+7yuo8zCb7dKNAVMbzNDwMPP+AABQFYmD0YMRcbpTmK5d lkXzZv6dMfTgsblz1QpgmlCMQYURfuAyDYY+LTwJVSoyaxuzO0VTrmyig8ZyzLlt4gFe 33x+HH99ADIYnV8KUeDdXr56371oaTqrqNvmSTt6227sWeWWZel70pYt7NRU5JIQBbqk dkeXWIomDO1P2L87KuUEEvFqiGg+r/d/l8ioHf3O2ByKytu033BK95/rP6OF0/Asp4QX 8bUGBLdq4E+7kmtQka8pr799ibCRCSHuXrmkV19bYJnKtG+Cpn19H96gJUT3rPp5iCVc 7MKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=30Ghk9S+Db/4MNlRoFa8BA0GRxVmoKsIYXlEULrFnDI=; b=rIUg+uk6iLAJklnBwuEUsF7525VcA1OuPoprA7hIuqASS6AAQl25n1Qdd4EZYEZxwh SoH+B6lm98NwhGe/W/w+yRosTkx5q19fr8lGwu0QaKwRlFXTSj6GzbkmpylhQnMscy7v KIXZR/giKmCRrNvCM7NBeU+uzKcLgkEP4sbMmVDJXedyDrh3lyaWbCHRczb05SzbACOU mJpx8aXHCHmPW9M7dePhDl2JL9G9v/2P26MZ15Zvt6cRTflamcVXhKzebxVzPMp08K38 V9mz40HSKS4WRvu78dH/lzFXYaxEOw4jgM1QJSzJg4N8nQ5NbQkZXyPOFkqn5d0+Y3Pv BC5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=J77oYX2n; 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 i9-v6si23116390plt.111.2018.10.19.01.58.10; Fri, 19 Oct 2018 01:58:26 -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=pass header.i=@ffwll.ch header.s=google header.b=J77oYX2n; 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 S1727139AbeJSRBf (ORCPT + 99 others); Fri, 19 Oct 2018 13:01:35 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:37613 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726389AbeJSRBe (ORCPT ); Fri, 19 Oct 2018 13:01:34 -0400 Received: by mail-qt1-f196.google.com with SMTP id d14-v6so37451354qto.4 for ; Fri, 19 Oct 2018 01:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=30Ghk9S+Db/4MNlRoFa8BA0GRxVmoKsIYXlEULrFnDI=; b=J77oYX2nDTUDTDwklDe43wQQL+Qz3/lzSYHS8zwLFYvoPQBJc1+VU0WPwc51M8aoU2 4hSsDGJz6AgcTNoZEgZLL8QRxbbPhMfqgOHu3RZ5FpLibBz+yx0q8jnU4DVwMmJASK3B MPs+waRFRyyl+6ONjbVLLC03z+5rn90W+MgBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=30Ghk9S+Db/4MNlRoFa8BA0GRxVmoKsIYXlEULrFnDI=; b=ZO5Hx7Xnb6T8H8AXi9MPaLSd/UGpSUCaLC4I5lonVHkBP3Vqtn1cOmHWV2tj7sZJ2s yS8tA0k92xc5aO/77QwUKV14s4Qaw2ZyzntyX/+00p4nNDe1qJ08T0G21qbat4mSUoMK ZoXloVC3hXZF+OcRvzp1Teh7L8C2B55zc4SV0Tf43ofiXnlacJli1UF9pNQD/5mTgDi/ ZhZMzW6BpBAjSNBULop7ArT7x3lwUNaw2nhbbfiyy/74hAfg1mjJZ+eySc4b66Z8opKA BxkBsHBo4rtXILoiEL8nQMpOCn5I69zgiaDZd8vG4ScuhKpMUznujPmNVEITH/ZJfJqo 3/0w== X-Gm-Message-State: ABuFfojwla5qddBnfDBlEwR4faU7a7VyA3BebT9jVG7s5C5Vpun5Or3B Gk8qT5qQKJ4oRDVlF77liJBgtBmV7cBHGXhVcyFI5Q== X-Received: by 2002:aed:2791:: with SMTP id a17-v6mr32021609qtd.303.1539939384762; Fri, 19 Oct 2018 01:56:24 -0700 (PDT) MIME-Version: 1.0 References: <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> <20181008174628.GB11442@roeck-us.net> <4a1faa3b-8c42-b742-9b55-9d2711f7ecc1@amd.com> <20181019085308.GY31561@phenom.ffwll.local> In-Reply-To: <20181019085308.GY31561@phenom.ffwll.local> From: Daniel Vetter Date: Fri, 19 Oct 2018 10:56:13 +0200 Message-ID: Subject: Re: [PATCH] amdgpu/gmc : fix compile warning To: =?UTF-8?Q?Christian_K=C3=B6nig?= , Guenter Roeck , Peng Hao , Dave Airlie , Linux Kernel Mailing List , amd-gfx list , dri-devel , Alex Deucher , "Peres, Martin" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 10:53 AM Daniel Vetter wrote: > > On Mon, Oct 08, 2018 at 06:13:56PM +0000, Koenig, Christian wrote: > > Am 08.10.2018 um 19:46 schrieb Guenter Roeck: > > > 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. > > > > Correct, yes. But that is the reason why I recommend using memset() for > > zero initialization. > > > > See we don't know the inner layout of the structure, could be another > > structure or an union. > > > > If it's a structure everything is fine because if you initialize one > > structure member all other get their default type (whatever that means), > > but if it's an union..... > > > > Not sure if compilers still react allergic to that, but its the status > > I've learned the hard way when the C99 standard came out and it still > > seems like people are working around that so I recommend everybody to > > stick with memset(). > > Went boom: > > https://bugs.freedesktop.org/show_bug.cgi?id=108490 > > Can we revert? > > Also, can we properly igt this so that intel-gfx-ci could test this before > it's all fireworks? Please disregard this reply, that was the wrong thread. Sorry, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch