🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by pasieka%sureal Fri, 11 Dec 1992 17:46
Small addition
#1530
Author: pasieka%sureal
Date: Fri, 11 Dec 1992 17:46
55 lines
1984 bytes
I have been looking at and modifying GCC 2.2.2 for the project I am
working on here at UMass. I have found what I consider to be a slight
error in the file stmt.c. Specifically the macro POPSTACK does not
correctly adjust the value of nesting_depth. The original macro is:

#define POPSTACK(STACK)					\
do { int initial_depth = nesting_stack->depth;		\
     do { struct nesting *this = STACK;			\
	  STACK = this->next;				\
	  nesting_stack = this->all;			\
	  nesting_depth = this->depth;			\
	  obstack_free (&stmt_obstack, this); }		\
     while (nesting_depth > initial_depth); } while (0)

I have added to the last line a decrementation of nesting_depth as follows:

#define POPSTACK(STACK)					\
do { int initial_depth = nesting_stack->depth;		\
     do { struct nesting *this = STACK;			\
	  STACK = this->next;				\
	  nesting_stack = this->all;			\
	  nesting_depth = this->depth;			\
	  obstack_free (&stmt_obstack, this); }		\
     while (nesting_depth > initial_depth);  --nesting_depth; } while (0)

Given the following program:

main ()
{
  int x, y, z;

  y = 0;
  z = 0;

  for (x=1 ; x<10; x++) {
    y++;
  }

  for (x=1 ; x<10; x++) {
    z++;
  }

}

the value of nesting_depth while parsing both y++ and z++ should be 2.
Without the change the value is correct while parsing y++ but is 3
while parsing z++.

Is this a bug or a feature?

Please feel free to contact me about this if I can provide more
information. I can be reached via email at pasieka@cs.umass.edu or by
phone at 413/545-2447.

-- Michael
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads