From: mrs@cygnus.com (Mike Stump)
Subject: Re:  HP Snake-specific bug with forward-declared inline functions
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 21 Dec 1992 21:13:09 GMT

This problem has been fixed, and should not exist in the next release of gcc.

> Date: Mon, 24 Aug 92 18:14:43 PDT
> From: jbuck@ohm.berkeley.edu (Joe Buck)
> Message-Id: <9208250114.AA28409@ohm.Berkeley.EDU>
> To: bug-g++@prep.ai.mit.edu

> For the following program, g++ 2.2.2 emits a reference to an
> undefined label, causing the assembler to fail, on the HP Snake
> (configure hp720-hpux).

> The error occurs only with optimization on.  It occurs for the Snake
> but not for Sparc or DecStation platforms.  Here is the -v output:
> ------------------------------------------------------------------------
> % g++ -v -O -c tt.cc
> g++ -v -O -c tt.cc 
> Reading specs from /ohm3/users/messer/hp-gnu/lib/gcc-lib/hp720-hpux/2.2.2/specs
> gcc version 2.2.2
>  /ohm3/users/messer/hp-gnu/lib/gcc-lib/hp720-hpux/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D___HPUX_SOURCE__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -D___HPUX_SOURCE -D__OPTIMIZE__ tt.cc /usr/tmp/cca20455.i
> GNU CPP version 2.2.2 (hp9000s800)
>  /ohm3/users/messer/hp-gnu/lib/gcc-lib/hp720-hpux/2.2.2/cc1plus /usr/tmp/cca20455.i -quiet -dumpbase tt.cc -O -version -o /usr/tmp/cca20455.s
> GNU C++ version 2.2.2 (hp9000s800) compiled by GNU C version 2.2.2.
>  as -o tt.o /usr/tmp/cca20455.s
> as: [err#7403]
>   undefined label - haltRequested__10SimControl (7403)
> /ohm3/users/messer/hp-gnu/bin/gcc: tt.o: No such file or directory
> ------------------------------------------------------------------------

> Here is the input, used above as tt.cc.  It is a preprocessor output.
> Removing the "#" lines removes the error.

> ------------------------------------------------------------------------
> # 1 "t.cc"
> # 1 "SimControl.h" 1

> #pragma interface

> class Star;
> class SimAction;
> class SimActionList;
> typedef void (*SimActionFunction)(Star*,const char*);
> typedef int (*SimHandlerFunction)();

> class SimControl {
> 	friend class SimControlOwner;
> public:
> 	enum flag_bit {
> 		halt = 1,
> 		error = 2,
> 		interrupt = 4,
> 		poll = 8 };
> 	 
> 	static int doPreActions(Star * which) {
> 		return (nPre > 0) ? internalDoActions(preList,which)
> 			: !haltRequested();
> 	}

> 	static int doPostActions(Star * which) {
> 		return (nPost > 0) ? internalDoActions(postList,which)
> 			: !haltRequested();
> 	}
> 	 
> 	static SimAction* registerAction(SimActionFunction action, int pre,
> 			       const char* textArg = 0, Star* which = 0);

> 	static SimHandlerFunction setInterrupt(SimHandlerFunction f) {
> 		SimHandlerFunction ret = onInt;
> 		onInt = f;
> 		return ret;
> 	}

> 	static SimHandlerFunction setPoll(SimHandlerFunction f) {
> 		SimHandlerFunction ret = onPoll;
> 		onPoll = f;
> 		flags |= poll;
> 		return ret;
> 	}

> 	static int cancel(SimAction*);

> 	static void requestHalt () {
> 		flags |= halt;
> 	}
> 	static void declareErrorHalt () {
> 		flags |= (error|halt);
> 	}
> 	static void clearHalt () {
> 		flags = 0;
> 	}

> 	static int haltRequested () {
> 		if (flags != 0) processFlags();
> 		return haltStatus();
> 	}

> 	static unsigned int flagValues() { return flags;}

> 	static void catchInt(int signo = -1, int always = 0);

> private:
> 	static int haltStatus () {
> 		return (flags & halt) != 0;
> 	}

> 	static void intCatcher(int);

> 	static void processFlags();
> 	static int internalDoActions(SimActionList*,Star*);

> 	static SimActionList * preList;
> 	static SimActionList * postList;
> 	static unsigned int flags;
> 	static int nPre, nPost;
> 	static SimHandlerFunction onInt, onPoll;
> };

> # 1 "t.cc" 2


> int fire() {
> 	if (!SimControl::doPreActions(0)) return 0 ;
> 	else return SimControl::doPostActions(0);
> }

Newsgroups: gnu.g++.bug