[gnu.g++.bug] Some g++ bugs

piggy@GARGOYLE.UCHICAGO.EDU (09/01/89)

We're running g++ 1.35.1 on Sun 3's with Sun OS 3.5 and on Sun 4's with
Sun OS 4.0.1.  The machine gargoyle is a Sun 3 and the machine
tartarus is a Sun 4.

On the Sun 3's tm.h was tm-sun3+.h and md was m68k.md.
On the Sun 4's tm.h was tm-sparc+.h and md was sparc.md.

If you have questions, direct them to keenan@gargoyle.uchicago.edu,
but we would appreciate a cc: to csstaff@gargoyle.uchicago.edu.

				     -- La Monte H. Yarroll
			Preferred:	piggy@gargoyle.uchicago.edu
			Permanent:	piggy@chinet.chi.il.us

Forwarded messages follow -------------------------------------------------

(Message inbox:14)
Received: by gargoyle.uchicago.edu (5.59/1.14)
	id AA18281; Fri, 25 Aug 89 09:36:39 198
Date: Fri, 25 Aug 89 09:36:39 198
From: "Tom Barron" <thos>
Message-Id: <8908251436.AA18281@gargoyle.uchicago.edu>
To: piggy
Subject: [keenan@gargoyle.uchicago.edu: g++ crash]

Return-Path: <keenan@gargoyle.uchicago.edu>
Date: Mon, 10 Jul 89 15:06:46 198
From: "Philip Keenan" <keenan@gargoyle.uchicago.edu>
To: bugs@gargoyle.uchicago.edu
Subject: g++ crash
Cc: keenan@gargoyle.uchicago.edu

The following source code, which is OK on other versions of g++, crashes
the compiler, dumping core.
Run with:
	g++ -c pde.cc

****************************************
/* pde.cc
   test program : why does it crash the compiler when the PDE declared?
   Phil Keenan 7-10-89
*/

#include <stream.h>
#include "p.h"

main()
{
  cout << "Start";
  PDE L;
  cout << "End";
}

****************************************
Here is the header file:

//p.h

struct point { 
  double x ; 
  double y ; 
  double z ; 
    point( ) { x =y =z =0 ;} 
    point( double x0 , double y0 = 0 , double z0 = 0 ) { x =x0 ;y =y0 ;z =z0 ;} 
    point( point & p ) { x =p .x ;y =p .y ;z =p .z ;} 
  void operator =( point & p ) { x =p .x ;y =p .y ;z =p .z ;} 
  int operator == ( point & p ) ; 
  } 
; 

typedef double ( * DF ) ( point & ) ; 
typedef double ( * DFV ) ( point & , void * ) ; 
class funct { 
  void * fn ; 
  int i ; 
  void * data ; 
  public : 
    funct( ) { i =0 ;} 
    funct( DF Fn ) { i =-1 ;fn =Fn ;data =0 ;} 
    funct( DFV Fn , void * Data ) { i =1 ;fn =Fn ;data =Data ;} 
    funct( funct & f ) { fn =f .fn ;i =f .i ;data =f .data ;} 
  operator =( funct & f ) { fn =f .fn ;i =f .i ;data =f .data ;} 
  virtual double value ( point & p ) ; 
  } 
; 

struct PDE { 
  int dim ; 
  funct a [ 3 ] [ 3 ] ; 
  funct aderiv [ 3 ] [ 3 ] ; 
  funct b [ 3 ] ; 
  funct bderiv [ 3 ] ; 
  funct c [ 3 ] ; 
  funct e ; 
  funct f ; 
  funct p ; 
  funct pp ; 
  } 
; 
extern double oneF ( point & p ) ; 
*****************************************
The PDE object uses vectors of "funct"s, but that is OK on other
systems. But this version crashes.

This is actually a code fragment from a larger project I am porting to
gargoyle, so if you can find what is wrong I would greatly appreciate it.

Thanks!
Phil Keenan

(Message inbox:15)
Received: by gargoyle.uchicago.edu (5.59/1.14)
	id AA18285; Fri, 25 Aug 89 09:36:57 198
Date: Fri, 25 Aug 89 09:36:57 198
From: "Tom Barron" <thos>
Message-Id: <8908251436.AA18285@gargoyle.uchicago.edu>
To: piggy
Subject: [keenan%tartarus@gargoyle.uchicago.edu: crash of g++ while compiling on tartarus/gargoyle]

Return-Path: <keenan%tartarus@gargoyle.uchicago.edu>
Date: Thu, 13 Jul 89 15:59:16 CDT
From: keenan%tartarus@gargoyle.uchicago.edu (Philip Keenan)
To: bugs%tartarus@gargoyle.uchicago.edu,
        csstaff%tartarus@gargoyle.uchicago.edu
Subject: crash of g++ while compiling on tartarus/gargoyle

Here is a much smaller test program than the previous one I sent you,
which still causes g++ to core-dump while compiling, yet which compiles
fine with CC (on gargoyle only). It makes use of a 2-dimensional array,
but that should not be unreasonable.
Phil Keenan

**************************

/* bug.cc

   This very short program still crashes the g++ compiler, causing
   a core dump, when it gets to defining 'p' in 'main'.

   Phil Keenan 7-13-89
*/

struct funct { 
  int i;
  funct() {} 
};

struct pde { 
  funct a[1][1]; 
  funct b;
};

main()
{
  pde p;
}

*************************
Thanks!

(Message inbox:16)
Received: by gargoyle.uchicago.edu (5.59/1.14)
	id AA18321; Fri, 25 Aug 89 09:40:47 198
Date: Fri, 25 Aug 89 09:40:47 198
From: "Tom Barron" <thos>
Message-Id: <8908251440.AA18321@gargoyle.uchicago.edu>
To: piggy
Subject: [keenan@tartarus.UChicago.EDU: GNU C++ compiler crash -- another bug]

Date: Fri, 28 Jul 89 13:36:22 CDT
From: keenan@tartarus.UChicago.EDU (Philip Keenan)
To: bugs@tartarus.uchicago.edu
Subject: GNU C++ compiler crash -- another bug
Cc: keenan@tartarus.uchicago.edu

This time I have a program which compiles fine with the command
g++ in.cc
but which crashes the compiler, causing a core dump, with the command
g++ -finline-functions in.cc
As usual, the program I am including is very short, so short that
inlining functions is hardly necessary, but the compiler crash
initially occured in a larger program of mine in which I do wish
to use inlining.
*********************************************
/* in.cc
   This is a test of the -finline-functions option which crashes the
   GNU C++ compiler. Compile with:

   g++ -finline-functions in.cc

   Note, it works fine if you just use

   g++ in.cc

   Phil Keenan 7-28-89
*/

int smallFn(int l,int f)
{
  int buf[4];
  buf[0]=0;
  return buf[0];
}

int callerFn(int l, int f)
{
  return smallFn(l,f);
}

int main()
{
  return callerFn(0,0);
}
*********************************************
Thanks -- let me know if you need more info!
Phil Keenan


------- End of Forwarded Message