From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C1C43858402; Thu, 21 Dec 2023 15:59:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C1C43858402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703174346; bh=HwcmgI7sTByG6ZGFaKf8d+UnURvgeLczn53UmmlEk3Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LR5yXGC6DsldXwjQKEQQfgJfbBV96fJTBdQSF6JNTqq4qCS99Wga/GjNerRaesNDO JJPgoPAkQdvY/8pDB2QkkVc4Ou0Zeln5OU6mxv/sJasK4LCncPFm/y5oafHMJaNPnG 4yYrzCkvKbpfFexxwjJOv55le5ksRwrOmCvVbpV4= From: "hp at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug sim/31181] sim: cris: decode unused base_insn variable warnings Date: Thu, 21 Dec 2023 15:59:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: sim X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hp at sourceware dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31181 --- Comment #9 from Hans-Peter Nilsson --- (In reply to Mike Frysinger from comment #8) > (In reply to Hans-Peter Nilsson from comment #5) > > Developers can be expected to have a sufficiently modern gcc > > ... > > I don't have a new enough gcc to emit those particular ones >=20 > one person's modern is another's too-old ;) Shades of grey and no absolutes... New, but not new enough for the warnings *you* see. Some put gcc-10 in the "oldstable", soon enough "oldoldstable".= =20 When I compiled those files, I saw *other* warnings, some for uninitialized variables, but probably false-positive-warning-bugs in that gcc version. > > But, for that kind of change, this PR should be redirected to that proj= ect, > > as the template is there, in cgen/sim-decode.scm according to git grep. >=20 > sure, if we think the right place is cgen, i can send it there. i wasn't > sure if it was something we'd do entirely there, or if we'd change > cpu/cris.cpu, or both. >=20 > ideally there would be something in the cpu definition that cgen could key > of off (like the arguments passed down, or what implicitly requested more > fields be decoded, or something else). if that's not feasible, then i'd = go > with: >=20 > --- a/sim-decode.scm > +++ b/sim-decode.scm > @@ -436,7 +436,14 @@ void > " const IDESC *idesc =3D &" IDESC-TABLE-VAR "[itype];\n" > (if (> (length (sfmt-iflds sfmt)) 0) > (string-append > - " CGEN_INSN_WORD insn =3D " > + " " > + ; Some insns are fully decoded by the time they get here, so they > won't > + ; access the insn variable. Mark it as unused to avoid warnings. > + and don't need the i That last line seems superfluous and should yield errors. (Accidentally qu= oted an untested diff?) > + (if (adata-integral-insn? CURRENT-ARCH) > + "" > + "ATTRIBUTE_UNUSED ") Oh, they have "ATTRIBUTE_UNUSED". Ok, that settles the question whether the cgen project cares about unused variables: they do. Beware that (IIRC) not= all compilers (old gcc, perhaps *cough* clang) support the same *location* for = the attribute (here, before the type). The canonical position is after; "before the ';'". I see gcc-10 accepts it where you put it though, so I'm good. > + "CGEN_INSN_WORD insn =3D " > (if (adata-integral-insn? CURRENT-ARCH) > "entire_insn;\n" > "base_insn;\n")) I don't know whether the "adata-integral-insn?" predicate has bearing on whether insn can be "unused". Still: besides the superfluous line, I'd say = time to post it for review, with a link to this PR. --=20 You are receiving this mail because: You are on the CC list for the bug.=