🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Stephen Ng Thu, 20 Jul 1989 16:27
bug in g++ 1.34.0
#288
Author: Stephen Ng
Date: Thu, 20 Jul 1989 16:27
208 lines
6489 bytes
I'd like to report a bug in g++ 1.34.0.  The following test case 
produces bad code--a function that should return true returns false
instead.  I've included a shell script which compiles the code and
runs it through different cases, and a log of the output.  

We are using tm-sun3.h, and m68k.md.

The compiler flags are given in the shell script.

I am running this on a Next machine, running Mach.  We are using 
release 0.9 of the Next software.


Thanks,

Stephen Ng

---------------------Cut Here--------------------------------------
: shar archive
: run this file through /bin/sh to extract its contents
if test -r "test.cc"
then
	echo "Will not overwrite existing copy of test.cc"
else
	echo "Extracting test.cc"
	sed 's/^X//' > test.cc <<\!!!END-OF-FILE!!!
X/********* PARAMETERS TO TURN THE BUG ON OR OFF *************/
X/*********** DEFAULT VALUES CAUSE BUG TO OCCUR **************/
X
X#if !defined(DATUM_TYPE)		// data type of model & table numbers
X#define DATUM_TYPE char
X#endif
X
X#if !defined(INLINE)
X#define INLINE inline
X#endif
X
X#define BEFORE 0
X#define AFTER 1
X#define NO_LOCAL 2
X
X#if !defined(LOCAL_VAR_POSITION)
X#define LOCAL_VAR_POSITION AFTER
X#endif
X
X/************************************************************/
X
Xtypedef unsigned DATUM_TYPE MDLNO;
Xtypedef unsigned DATUM_TYPE TBLNO;
X
Xclass TH {
X
X	MDLNO ModelNumber;						// External model # (0 is self)
X	TBLNO TableNumber;						// Table # within designated model
X
Xpublic:
X
X	//	N.B.	Definitions are deferred until after the class declaration to
X	//			get around a G++ bug with declaring constructors/destructors
X	//			to be "inline".
X
X	TH(MDLNO mdlno, TBLNO tblno);
X
X	INLINE MDLNO& theModel()			// Get/Set model
X		{return(ModelNumber);}
X
X	INLINE TBLNO& theTable()			// Get/Set Table
X		{return(TableNumber);}
X
X	INLINE int equal(TH cmp) {
X		return (ModelNumber==cmp.theModel()) &&
X				(TableNumber==cmp.theTable());
X		}
X};
X//	Deferred definitions of constructors and destructors.
Xstatic INLINE TH::TH(MDLNO mdlno, TBLNO tblno)
X	{ModelNumber = mdlno; TableNumber = tblno;}
X
Xclass test_class
X{
Xpublic:
X  TH test_class_th;
X
X  test_class(MDLNO m, TBLNO t);
X
X  void test_me(MDLNO m, TBLNO t);
X};
X
Xtest_class::test_class(MDLNO m, TBLNO t) :
X  test_class_th(m, t)
X{
X}
X
Xvoid test_class::test_me(MDLNO m, TBLNO t)
X	{
X#if LOCAL_VAR_POSITION == BEFORE
X	  char local_char;
X#endif
X
X	  TH			localTH(m, t);
X
X#if LOCAL_VAR_POSITION == AFTER
X	  char local_char;
X#endif
X	  if (test_class_th.equal(localTH) )
X		printf("generated good code\n");
X	  else
X		printf("generated bad code\n");
X	}
X
Xmain()
X{
X
X  test_class f(1, 2);
X
X  f.test_me(1, 2);
X}
!!!END-OF-FILE!!!
fi
if test -r "do_test"
then
	echo "Will not overwrite existing copy of do_test"
else
	echo "Extracting do_test"
	sed 's/^X//' > do_test <<\!!!END-OF-FILE!!!
X#!/bin/sh
X#
X#Generate run all variations of test program to see which generate bugs
X
Xgentest(){
X# $1 is DATUM_TYPE
X# $2 is VAR_POSITION
X# $3 is INLINE=
X
Xif [ -z "$3" ]
Xthen OFILE=test.$1.$2.no_inline
Xelse OFILE=test.$1.$2.inline
Xfi
X
Xecho compiling g++ -DDATUM_TYPE=$1 -DLOCAL_VAR_POSITION=$2 -DINLINE=$3 -o $OFILE test.cc
Xg++ -DDATUM_TYPE=$1 -DLOCAL_VAR_POSITION=$2 -DINLINE=$3 -o $OFILE -L/exec/lib test.cc
Xecho Running $OFILE
X$OFILE
X}
X
X# MAIN
X
Xgentest char BEFORE  inline
Xgentest char AFTER  inline
Xgentest char NO_LOCAL  inline
Xgentest short BEFORE  inline
Xgentest short AFTER  inline
Xgentest short NO_LOCAL  inline
Xgentest char BEFORE  
Xgentest char AFTER  
Xgentest char NO_LOCAL  
Xgentest short BEFORE  
Xgentest short AFTER  
Xgentest short NO_LOCAL  
X
X
X
!!!END-OF-FILE!!!
fi
if test -r "do_test.log"
then
	echo "Will not overwrite existing copy of do_test.log"
else
	echo "Extracting do_test.log"
	sed 's/^X//' > do_test.log <<\!!!END-OF-FILE!!!
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=BEFORE -DINLINE=inline -o test.char.BEFORE.inline test.cc
XRunning test.char.BEFORE.inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=AFTER -DINLINE=inline -o test.char.AFTER.inline test.cc
XRunning test.char.AFTER.inline
Xgenerated bad code
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=NO_LOCAL -DINLINE=inline -o test.char.NO_LOCAL.inline test.cc
XRunning test.char.NO_LOCAL.inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=BEFORE -DINLINE=inline -o test.short.BEFORE.inline test.cc
XRunning test.short.BEFORE.inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=AFTER -DINLINE=inline -o test.short.AFTER.inline test.cc
XRunning test.short.AFTER.inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=NO_LOCAL -DINLINE=inline -o test.short.NO_LOCAL.inline test.cc
XRunning test.short.NO_LOCAL.inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=BEFORE -DINLINE= -o test.char.BEFORE.no_inline test.cc
XRunning test.char.BEFORE.no_inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=AFTER -DINLINE= -o test.char.AFTER.no_inline test.cc
XRunning test.char.AFTER.no_inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=char -DLOCAL_VAR_POSITION=NO_LOCAL -DINLINE= -o test.char.NO_LOCAL.no_inline test.cc
XRunning test.char.NO_LOCAL.no_inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=BEFORE -DINLINE= -o test.short.BEFORE.no_inline test.cc
XRunning test.short.BEFORE.no_inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=AFTER -DINLINE= -o test.short.AFTER.no_inline test.cc
XRunning test.short.AFTER.no_inline
Xgenerated good code
Xcompiling g++ -DDATUM_TYPE=short -DLOCAL_VAR_POSITION=NO_LOCAL -DINLINE= -o test.short.NO_LOCAL.no_inline test.cc
XRunning test.short.NO_LOCAL.no_inline
Xgenerated good code
!!!END-OF-FILE!!!
fi
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