🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #23

GCC 2.3.1: incorrect error reporting in cp-decl.c, includes bug fix

#23
From: Gerald Baumgartner
Date: Mon, 02 Nov 1992 20:15
103 lines
3937 bytes
In the declaration

	class c { public: extern signed foo (void); };

no error is reported.  The use of `signed,' `unsigned,' or `inline' makes
the use of `extern,' `auto,' or `register' go undetected.

When I reported the bug the first time, the buggy code was only moved
to a different place in the the function `grokdeclarator'.  The second
time I reported it, it wasn't fixed yet.

Could you, please, tell me when it will be fixed (or if that's
supposed to be correct behavior)?  We are working on adding a
`signature' construct to C++, and I'd like to make a first beta test
version available within the next few weeks.  My code uses a similar
error check, so I would like to know whether I can include the fix or
whether I should program around it.

The fix for cp-decl.c, version 2.3.1, is at the end of this message.

Thanks,

Gerald

> From: gb@cs.purdue.edu (Gerald Baumgartner)
> Newsgroups: gnu.g++.bug
> Subject: GCC 2.2.2 (920613): incorrect error reporting in cp-decl.c
> Date: 24 Jun 92 20:47:47 GMT
> Distribution: gnu
> Organization: Department of Computer Science, Purdue University
> 
> If a structure field or method contains an illegal source specifier
> (e.g., `extern') together with either `signed,' `unsigned,' or
> `inline,' then no error is reported for the illegal source specifier.
> 
> I had reported the error earlier (for GCC 2.1).  Instead of fixing the
> bug, the buggy piece of code in `grokdeclarator' has only been moved
> to a different place.
> 
> Here are the old bug report and a new diff.
> 
> --Gerald
> 
> > From: gb@cs.purdue.edu (Gerald Baumgartner)
> > Newsgroups: gnu.g++.bug
> > Subject: G++ 2.1: incorrect error reporting in cp-decl.c
> > Date: 8 May 92 10:40:16 GMT
> > Distribution: gnu
> > Organization: Department of Computer Science, Purdue University
> > 
> > [Please, ignore my previous bug fix.  This one fixes one more error.]
> > 
> > In the declaration
> > 
> > 	class c { public: extern signed foo (void); };
> > 
> > no error is reported.  If `signed' is replaced by `int,' for example,
> > the error is reported correctly.  Also with `unsigned' and `inline'
> > the error message is missing.
> > 
> > The code in the bug fix below is executed
> > 
> > 	if (decl_context != NORMAL && nclasses > 0)
> > 
> > Since `nclasses' is not incremented for `signed,' `unsigned,' and
> > `inline,' the appropriate cases should be taken out of the if
> > condition below.
> > 
> > --Gerald
> >
> > [old diff deleted]
> 
> [old diff deleted]

*** cp-decl.c~	Sat Oct 17 16:46:06 1992
--- cp-decl.c	Mon Nov  2 14:33:39 1992
*************** grokdeclartor ()
*** 7242,7255 ****
  	  return loc_typedecl;
  	}
        else if (decl_context == FIELD
! 	       && (specbits
! 		   & (/* C++ allows static class elements  */
! 		      (1 << (int) RID_STATIC)
! 		      /* ...and inlines  */
! 		      | (1 << (int) RID_INLINE)
! 		      /* ...and signed and unsigned elements.  */
! 		      | (1 << (int) RID_SIGNED)
! 		      | (1 << (int) RID_UNSIGNED))))
  	;
        else
  	{
--- 7242,7251 ----
  	  return loc_typedecl;
  	}
        else if (decl_context == FIELD
! 	       /* C++ allows static class elements  */
! 	       && (specbits & (1 << (int) RID_STATIC)))
! 	/* C++ also allows inlines and signed and unsigned elements,
! 	   but in those cases we don't come in here.  */
  	;
        else
  	{
Technical Details
Message-ID: <199211022015.AA19207@ector.cs.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!hri.com!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!hri.com!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb
From: gb@cs.purdue.edu (Gerald Baumgartner)
Newsgroups: gnu.g++.bug
Subject: GCC 2.3.1: incorrect error reporting in cp-decl.c, includes bug fix
Message-ID: <199211022015.AA19207@ector.cs.purdue.edu>
Date: 2 Nov 92 20:15:13 GMT
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 103
Approved: bug-g++@prep.ai.mit.edu