From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B12213857008; Tue, 11 Aug 2020 10:55:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B12213857008 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug m2/26372] New: [Modula-2] Parsing of multi-subscript arrays broken Date: Tue, 11 Aug 2020 10:55:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: m2 X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2020 10:55:25 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26372 Bug ID: 26372 Summary: [Modula-2] Parsing of multi-subscript arrays broken Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: m2 Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- When building gdb I see these warnings: ... src/gdb/m2-exp.y: warning: 34 shift/reduce conflicts [-Wconflicts-sr] src/gdb/m2-exp.y:301.25-52: warning: rule useless in parser due to conflicts [-Wother] ... Looking at line 301, it's related to multi-subscript: ... 296 /* Modula-2 array subscript notation [a,b,c...] */ 297 exp : exp '[' 298 /* This function just saves the number of arguments 299 that follow in the list. It is *not* specific to 300 function types */ 301 { pstate->start_arglist(); } 302 non_empty_arglist ']' %prec DOT 303 { write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); 304 write_exp_elt_longcst (pstate, 305=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 pstate->end_arglist()); 306 write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); } 307 ; 308 309 exp : exp '[' exp ']' 310 { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } 311 ; ... Using an existing modula-2 test-case, we have with single-subscript: ... $ gdb -batch \ outputs/gdb.modula2/max-depth/max-depth \ -ex start \ -ex "set language modula-2" \ -ex "print s3.s2.str[1]" Temporary breakpoint 1 at 0x4004ab: file max-depth.c, line 40. Temporary breakpoint 1, main () at max-depth.c:40 40 memcpy (s3.s2.str, "abcde\0fghi", 10); Warning: the current language does not match this frame. $1 =3D 4 ... and with multi-subscript: ... (gdb) print s3.s2.str[1,2] A syntax error in expression, near `,2]'. ... If we strip the conflicting rule m2-exp.y (line 309-311) we have instead: ... (gdb) print s3.s2.str[1,2] cannot subscript something of type `char' ... So, that confirms that we're current not able to parse multi-subscript expressions in modula-2. --=20 You are receiving this mail because: You are on the CC list for the bug.=