Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2823403lqz; Wed, 3 Apr 2024 09:31:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7etaZqIF6t7ZdHwYaOoG1mHeBBV0hr8ZOv3fCN0+845tGne6Az1CkbZ3d1lmlgJTHflpsL0HUzaxciOGXiOPTaV7b6OyMO7LNsMMoVQ== X-Google-Smtp-Source: AGHT+IEI6szibwSSzyg1OFVMWVQRC3fOj3LqID7ZrtaoMteFOwLIEXI/7cVA1/7Ix23rvxa/T+fz X-Received: by 2002:a05:6358:42a3:b0:17f:1c95:7b94 with SMTP id s35-20020a05635842a300b0017f1c957b94mr19711737rwc.12.1712161868301; Wed, 03 Apr 2024 09:31:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712161868; cv=pass; d=google.com; s=arc-20160816; b=JT9rWAX1txOWo8CYGeCLbS2N+mZZ9qqQfMFIgrWgLEj7hKZRuxMp1+rHMwgezw2VHY 8hxCpUxvqOpXGa7E4+sVtCElMSU7PZeVDFuh2i4A9MHXyps6CVixuJ1pDSgBGx2d2nnE kGglGByXPYXNOefwc2rDjqLzn+/V3ak0hmVf+OI8YVQoJdBfwzrs/vKBG+EmifkW8ZR1 WlNxSUq/ZhVMCDDf2stqe7K7wJIJVXZK67NKLrTKolKAjhuAtRgf4Pyj/iJP+upY7aMJ hxmNJsBC11dmjArp5671SI69MCmsVsl0pRpqKxL+dK05wSB0TbjnOiW73bcQjwxY14C3 FVYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=DNJPWByWF1sf2cxiFuFQ8vnWOdBcEetEGpATM1VlKMY=; fh=myDYI0sj7yHGzJNbiIzby2mkrBnJBiSKwGb+4t065Fs=; b=sU+3dUltY+E+/7AuF8SM0h6ymqMWKPFBKjVygCbOCdL1ugqWw7OOYYd4rNDvtj3luv xtWfsNwR+/mJD0rSIaDsHgrQuWonVThIOAF7ObbexYrSkfDW/J6z042PFB9DTV5omJft BmmMWYMmPj5ehJ80YkYJt7xjY6bFglqvAUe2acmneL7NHq8phDyI7iyz0xKVImaH0XUY k0036gahKJbgEXaH5ON5C8s/gHQ+E0Soj1kCpfjKOZ5YWUklZp9Zp9tmZHrfqHh4V/Dy jS8sthsQUD8eS+63Xi6PRbdZ8oBnVP9CdzS1I7IMDJa2QuwWOkBM/XhDyRcQQQ1/B1Bh pFCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CiX6esBp; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-130158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cm8-20020a056a020a0800b005e838a618besi15331461pgb.11.2024.04.03.09.31.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:31:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CiX6esBp; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-130158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3711DB2A96A for ; Wed, 3 Apr 2024 16:03:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80ED614A622; Wed, 3 Apr 2024 16:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CiX6esBp" Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A17C14A4FC for ; Wed, 3 Apr 2024 16:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160133; cv=none; b=Y0dwv7lIxhkmcgbGwI0I8qP/+efT3Ewth+m6AOfbW0lGqgrvaXEJ4lINibZU0WAL+kzbN3kkxSwEIVhnqJHZJr37do5RRDGSBM3cM0Kw2sO56mkJWeigJVg2VuIb16bvRjJczXkRMdxHQxbMSkUtBDuqdYBmakuwfN/3a7QPAFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160133; c=relaxed/simple; bh=fggrNF/asutMtICgsplQTd2yCftvwfY2ORt4VRhq/9c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FXXkvAkZau5dHz4+l6lzOJC9NiZmDDg1uAg5VhIGHmkOE1C2KJcFfMU7F4joUKyw/FI7ohnBWtUhILFheane0hWeNnQANr5q6ALXaybi/gX2IjnauJWned7PfyU51EhFVNMISPZh2oDUUuSdfw7SdAo+FzjGxJ7aF3tUSjWsdnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CiX6esBp; arc=none smtp.client-ip=209.85.160.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-430d3fcc511so349241cf.1 for ; Wed, 03 Apr 2024 09:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712160131; x=1712764931; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DNJPWByWF1sf2cxiFuFQ8vnWOdBcEetEGpATM1VlKMY=; b=CiX6esBpThvPhW1aV6nDa/R4olmPWgwlpgy08y649c7Rlyf8W3bTQHZGMG3FX0vS80 2CtzbAVwoP19UufoG7CoKWEtiSM5nK+YryI480c04LKYFFAFZIlZHeTC8emE80dQb59z 1Yvzd7lFiSUXFYC7dyHK1kDKZ6alrLDvV6o9tpCN9CVNbZzj+n7J8rqa3P5pVJxj3Mse 1OUmVBNyaGhySqOfjtIPGQhfqHoRjCgK4PD7jyIdbp8vw+NyhRD6UhqUND1UmAeUZUWX VHzQxSZFB7FTBl82Zb6nVk66b77eeLJX7F3apgq1X2izbYRn4lpn3K+hsZI7YUY1dmyv AsFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160131; x=1712764931; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DNJPWByWF1sf2cxiFuFQ8vnWOdBcEetEGpATM1VlKMY=; b=mjbYi18WdAb4yMlbgrhTLwj5mdPddPBEkAVeD35YyeWd++E4SaXjXEyhwjYz84709m YUglAP3RH9pjKIhV0i/UZOfSIxg2pgPtS7C6K4HmfvkSRVyGFW1VEfqe4jt9ElMB0Qb7 TccvgyqharwD/klJ1255KG8uGXTBJbtQnezPyDWncYsSdtmkqQg41lGmZtNdsAMSQI0f NrIV38jaInOCzoI3mfntf7jxdieYs1FBjT7N8mh1VdC9YgRO9rve7oKDaPg0QJYU3Fgw P3dj+fmuFAc12DHiLI9pqy2kQM/Qdj4afhyvkvgniRl63EVkg/RI0o0H+i1yg5bfaIvC AsTw== X-Forwarded-Encrypted: i=1; AJvYcCXV1CD/arMNOCIdCNHOFi2vOz+rv4mM8mCb4pZnFfBfElPnf8M/NkPyq/Cbr2EWzjE1/zoS57a2wJXJ+rgAXg8OoPsQh1WnVfYKDiyQ X-Gm-Message-State: AOJu0YzBbLIDC1nPbIYEeU7X+eR32Iy8+Ne2BXYoQxV9/XoRbm+Kqbwi 3LrOxr2T6Jc9ZlzfxrThQ2k0i9TMsN3607hVfoc9/idRDdrM5nDPKX1VoHpw53llnmTiba2M1WE IwvXERNBeA6r21E9VsGhRHNSgtodwCQ7CElVQs30AluBvq5xBuJ80EoY= X-Received: by 2002:a05:622a:164d:b0:431:3d25:f699 with SMTP id y13-20020a05622a164d00b004313d25f699mr269309qtj.19.1712160130621; Wed, 03 Apr 2024 09:02:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Ian Rogers Date: Wed, 3 Apr 2024 09:01:56 -0700 Message-ID: Subject: Re: [PATCH 1/1] perf annotate: Initialize 'arch' variable not to trip some -Werror=maybe-uninitialized To: Arnaldo Carvalho de Melo Cc: Namhyung Kim , Adrian Hunter , Jiri Olsa , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 3, 2024 at 8:16=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > In some older distros the build is failing due to > -Werror=3Dmaybe-uninitialized, in this case we know that this isn't the > case because 'arch' gets initialized by evsel__get_arch(), so just init > it to NULL to silence those cases. > > E.g.: > > 32 17.12 opensuse:15.5 : FAIL gcc version 7.5.0 (S= USE Linux) > util/annotate.c: In function 'hist_entry__get_data_type': > util/annotate.c:2269:15: error: 'arch' may be used uninitialized in t= his function [-Werror=3Dmaybe-uninitialized] > struct arch *arch; > ^~~~ > cc1: all warnings being treated as errors > > 43 7.30 ubuntu:18.04-x-powerpc64el : FAIL gcc version 7.5.0 = (Ubuntu 7.5.0-3ubuntu1~18.04) > util/annotate.c: In function 'hist_entry__get_data_type': > util/annotate.c:2351:36: error: 'arch' may be used uninitialized in t= his function [-Werror=3Dmaybe-uninitialized] > if (map__dso(ms->map)->kernel && arch__is(arch, "x86") && > ^~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > Cc: Adrian Hunter > Cc: Ian Rogers > Cc: Jiri Olsa > Cc: Namhyung Kim > Signed-off-by: Arnaldo Carvalho de Melo This looks fine but I couldn't line up the errors with code in the tree. I was curious why the "maybe-uninitialized" was failing. Perhaps evsel__get_arch should set the out argument to NULL when an error occurs. This fix is also good but may potentially need repeating for other evsel__get_arch cases, so a fix in evsel__get_arch may be preferable. Reviewed-by: Ian Rogers Thanks, Ian > --- > tools/perf/util/annotate.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index b795f27f26024f35..f316e0b65897957a 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -2266,7 +2266,7 @@ struct annotated_data_type *hist_entry__get_data_ty= pe(struct hist_entry *he) > { > struct map_symbol *ms =3D &he->ms; > struct evsel *evsel =3D hists_to_evsel(he->hists); > - struct arch *arch; > + struct arch *arch =3D NULL; > struct disasm_line *dl; > struct annotated_insn_loc loc; > struct annotated_op_loc *op_loc; > -- > 2.44.0 >