NetBSD Problem Report #51100

From root@here-be-dragons.its.iastate.edu  Fri Apr 29 03:15:48 2016
Return-Path: <root@here-be-dragons.its.iastate.edu>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 56CFE7AA91
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Apr 2016 03:15:47 +0000 (UTC)
Message-Id: <20160429014730.948011F4A88@here-be-dragons.its.iastate.edu>
Date: Thu, 28 Apr 2016 20:47:30 -0500 (CDT)
From: john@iastate.edu
Reply-To: john@iastate.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: cdecl rejects valid syntax
X-Send-Pr-Version: 3.95

>Number:         51100
>Category:       pkg
>Synopsis:       cdecl rejects valid C syntax
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dholland
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 29 03:20:00 +0000 2016
>Closed-Date:    Wed Jun 16 23:10:49 +0000 2021
>Last-Modified:  Wed Jun 16 23:10:49 +0000 2021
>Originator:     john@iastate.edu
>Release:        NetBSD 6.1.5
>Organization:
	Iowa State University of Science and Technology
>Environment:
System: NetBSD here-be-dragons.its.iastate.edu 6.1.5 NetBSD 6.1.5 (MONOLITHIC) i386
Architecture: i386
Machine: i386
>Description:
The cdecl program declares that having storage-class and
a type-qualifier is a syntax error, for example:
	cdecl> explain static const int jsb
	syntax error

Any combination of storage-class (auto, extern, register, static)
and type-qualifier (const, volatile, noalias) gives this result.

Interestingly, the reverse works fine:

	cdecl> declare jsb as static const int
	static const int jsb

BTW, the manpage also contains an error:

	<storage> ::= auto | extern | register | auto
should be:
	<storage> ::= auto | extern | register | static

>How-To-Repeat:
	This should be intuitively obvious to even the most casual observer.
>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->suspended
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 29 Apr 2016 06:44:46 +0000
State-Changed-Why:
Please report this upstream.


From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: john@iastate.edu
Subject: Re: pkg/51100: cdecl rejects valid syntax
Date: Thu, 26 May 2016 05:04:46 +0000

 On Fri, Apr 29, 2016 at 03:20:00AM +0000, john@iastate.edu wrote:
  > The cdecl program declares that having storage-class and
  > a type-qualifier is a syntax error, for example:
  > 	cdecl> explain static const int jsb
  > 	syntax error

 Try this patch... but please send it upstream, if there's any kind of
 non-comatose upstream. If there isn't, let us know and I'll commit it
 in pkgsrc as better than nothing.

 Note that the patch produces this change in the build output:
  -yacc: 7 shift/reduce conflicts.
  +yacc: 6 shift/reduce conflicts.

 It's quite likely that the other six conflicts also reflect bugs.


 --- cdgram.y~	1996-01-12 06:06:58.000000000 +0000
 +++ cdgram.y
 @@ -84,10 +84,20 @@ stmt		: HELP NL
  			docast(NullCP, $2.left, $2.right, $2.type);
  			}

 -		| EXPLAIN opt_storage opt_constvol_list type cdecl NL
 +		| EXPLAIN opt_constvol_list type cdecl NL
  			{
 -			Debug((stderr, "stmt: EXPLAIN opt_storage opt_constvol_list type cdecl\n"));
 -			Debug((stderr, "\topt_storage='%s'\n", $2));
 +			Debug((stderr, "stmt: EXPLAIN opt_constvol_list type cdecl\n"));
 +			Debug((stderr, "\topt_constvol_list='%s'\n", $2));
 +			Debug((stderr, "\ttype='%s'\n", $3));
 +			Debug((stderr, "\tcdecl='%s'\n", $4));
 +			Debug((stderr, "\tprev = '%s'\n", visible(prev)));
 +			dodexplain(ds(""), $2, $3, $4);
 +			}
 +
 +		| EXPLAIN storage opt_constvol_list type cdecl NL
 +			{
 +			Debug((stderr, "stmt: EXPLAIN storage opt_constvol_list type cdecl\n"));
 +			Debug((stderr, "\tstorage='%s'\n", $2));
  			Debug((stderr, "\topt_constvol_list='%s'\n", $3));
  			Debug((stderr, "\ttype='%s'\n", $4));
  			Debug((stderr, "\tcdecl='%s'\n", $5));
 @@ -105,14 +115,13 @@ stmt		: HELP NL
  			dodexplain($2, $3, NullCP, $4);
  			}

 -		| EXPLAIN opt_storage constvol_list cdecl NL
 +		| EXPLAIN constvol_list cdecl NL
  			{
 -			Debug((stderr, "stmt: EXPLAIN opt_storage constvol_list cdecl\n"));
 -			Debug((stderr, "\topt_storage='%s'\n", $2));
 -			Debug((stderr, "\tconstvol_list='%s'\n", $3));
 -			Debug((stderr, "\tcdecl='%s'\n", $4));
 +			Debug((stderr, "stmt: EXPLAIN constvol_list cdecl\n"));
 +			Debug((stderr, "\tconstvol_list='%s'\n", $2));
 +			Debug((stderr, "\tcdecl='%s'\n", $3));
  			Debug((stderr, "\tprev = '%s'\n", visible(prev)));
 -			dodexplain($2, $3, NullCP, $4);
 +			dodexplain(ds(""), $2, NullCP, $3);
  			}

  		| EXPLAIN '(' opt_constvol_list type cast ')' optNAME NL


 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: suspended->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 17 Oct 2016 01:01:07 +0000
State-Changed-Why:
It came to my attention just now that mail to this PR has been bouncing
due to having a wrong address in it. Have you seen the patch? Have you
contacted upstream at all?


From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51100 CVS commit: pkgsrc/devel/cdecl
Date: Wed, 16 Jun 2021 23:08:42 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Wed Jun 16 23:08:42 UTC 2021

 Modified Files:
 	pkgsrc/devel/cdecl: Makefile distinfo
 Added Files:
 	pkgsrc/devel/cdecl/patches: patch-cdgram.y

 Log Message:
 Add my patch for PR 51100 (from 2016) to devel/cdecl.

 This fixes a shift-reduce conflict in the parser that causes e.g.
 "static const int" to be rejected as a syntax error.

 This patch should have been handled by upstream, but there doesn't seem
 to be an upstream.


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 pkgsrc/devel/cdecl/Makefile
 cvs rdiff -u -r1.13 -r1.14 pkgsrc/devel/cdecl/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/devel/cdecl/patches/patch-cdgram.y

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: pkg-manager->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Wed, 16 Jun 2021 23:10:49 +0000
Responsible-Changed-Why:
I dun it


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 16 Jun 2021 23:10:49 +0000
State-Changed-Why:
fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.