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:    pkg-manager
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 29 03:20:00 +0000 2016
>Closed-Date:    
>Last-Modified:  Mon Oct 17 01:01:07 +0000 2016
>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?


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.