🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Rick D. Porter Wed, 06 Dec 1989 16:52
inline function bug?
#684
Author: Rick D. Porter
Date: Wed, 06 Dec 1989 16:52
60 lines
1544 bytes
I am a neophyte C++ user, but I believe that the following program
should not core dump as it does:

I am running version 1.36.1 on a Sun4 running SunOS 4.0.3.

I ran g++ with the -g option only.

The config files were sparc.md and tm-sparc.h.


The following program illustrates the problem.  It core dumps in
Field::Field( RegInfo ).  The problem occurs when get_val(), an
inline member function, is called and its return value is not used.
The problem does NOT occur if the return value is used or if
get_val() is not inline.  It also does NOT occur if I compile it on
a Sun3 with SunOS 4.0.

Rick Porter
Bellcore
(201) 829-4490

------------------------------------------------------------

struct RegInfo {
	char val;
	char fake;
	
};

class Field {
	RegInfo* rip;
	char get_val();
    public:
	  Field(RegInfo& ) ;
	  Field() {};
	  ~Field() {};
};


inline char Field::get_val()
{
	return rip->fake;
}


Field::Field( RegInfo& ri )
{
	rip = &ri;
	
	get_val();		// Core dumps here
	ri.val = get_val();	// This executes OK
}	

main()
{
	RegInfo ri;

	Field f(  ri );
	
}
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