🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

GCC 2.1: errors in cp-decl.c, cp-parse.y

#108
From: Gerald Baumgartner
Date: Tue, 07 Apr 1992 03:03
32 lines
1331 bytes
There are some run-time errors in GCC 2.1, cp-decl.c, (detected with Saber-C).

In cp-decl.c, line 578, there is the field declaration
(in struct binding_level):

	#ifdef PARANOID
	    unsigned char depth;
	#endif

And in line 711 (function pop_binding_level), the sign of this unsigned
char is reversed:

	#ifdef PARANOID
	    level->depth *= -1;
	#endif

What should that be, a substraction (level->depth -= 1;)?

And shouldn't there be `#if PARANOID' instead of `#ifdef PARANOID'?
In cp-tree.h, line 26, PARANOID is set to 0:

	#ifndef PARANOID
	#define PARANOID 0
	#endif

There is a more serious error with the use of finish_decl (cp-decl.c,
line 5068).  The function is supposed to be passed four parameters.
The fourth parameter, `need_pop', tells whether obstacks should be
popped.  In ALL the calls to finish_decl from cp-parse.y, only three
parameters are passed.

--Gerald
Technical Details
Message-ID: <18352@ector.cs.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.purdue.edu!gb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.purdue.edu!gb
From: gb@cs.purdue.edu (Gerald Baumgartner)
Subject: GCC 2.1: errors in cp-decl.c, cp-parse.y
Message-ID: <18352@ector.cs.purdue.edu>
Sender: gnulists@ai.mit.edu
Organization: Department of Computer Science, Purdue University
Distribution: gnu
Date: Tue, 7 Apr 1992 03:03:45 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 33