[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

egcs g++ compile error or what



Hi,

How much can egcs g++ for alpha be trusted?  I have a very weird segV
problem, that with gdb (GNU gdb 4.17.m68k.objc.threads.hwwp.fpu.gnat)
within emacs actually gives rise to even weirder behaviour.  The
compiler is egcs-2.91.58.

I don't know whether it is an egcs, g++, gdb, alpha, or my own problem. 

Below I have a sample gdb session.  The program is too complex to
explain in a concise way, but the particular excerpt shows:

 - start a debug session
 - breakpoint at main::, at call of m->writeMachine(pad, ...)
 - check pad="debug.wei"
 - step into machine::writeMachine(char * path, ...)
 - first argument path is pointer to 0x10, out of bounds. 

`pad' is type char[].  I would expect that the value of `pad' (called
`path' in the function prototype) cannot change on the zeroth line of
the method.  Is there something wrong with my function prototype?  

Weird is also, that gdb cannot trace the stack, at the start of the
method call. 

The problem reproduces more-or-less (at slightly different locations
within the method machine::writeMachine) on i386, both for g++_2.90.29

I hope that this is not a silly c++ thinking/programming error (it is
not my own code). 

Below the debug excerpt. 

---david



(gdb) run
Starting program: /home/david/abbot/src/rnn/rnnTrain -nout 39 -ninp 15 -nsta 256 -nsum 3200 -savet 1 -maxnpass 32 trainset-0.plp wei-debug/nrc-4.wei train-0-debug.log
reading data to node 0
pre_size: 1165864
errors checked -- allocating memory

process memory usage:	

Breakpoint 1, main (argc=16, argv=0x11ffffa00) at rnnTrain.cc:150
(gdb) list
145	  malloc_usage() ;
146	  fprintf( stdout, "\n" ) ;
147	
148	  // output the machine
149	  m->writeMachine(pad, comOpts.nsta, rate->npass, comOpts.meta, 
150			   rate->senergy0, rate->senergy1, rate->sncorrect ) ;
151	
152	
153	/* Do that training thing */
154	
(gdb) print pad
$1 = "debug.wei"
(gdb) step
machine::writeMachine (this=0x11ffffa00, 
    path=0x10 <Address 0x10 out of bounds>, nsta=0, npass=@0x120193108, 
    meta=@0x0, senergy0=@0x120194c88, senergy1=@0x0, sncorrect=@0x0)
    at slowMachine.cc:304
(gdb) list
299	}
300	
301	// write the machine to a file ------------------------------------------------
302	void machine::writeMachine( char *path, int nsta, float& npass, float& meta, 
303				    float& senergy0, float& senergy1, 
304				    float& sncorrect ) {
305	  int i;
306	
307	  // get the output file descriptor
308	  bostream bSave ;
(gdb) print path
$2 = 0x10 <Address 0x10 out of bounds>
(gdb) up
warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x12011f9b8
Initial frame selected; you cannot go up.
(gdb) bt
#0  machine::writeMachine (this=0x11ffffa00, 
    path=0x10 <Address 0x10 out of bounds>, nsta=0, npass=@0x120193108, 
    meta=@0x0, senergy0=@0x120194c88, senergy1=@0x0, sncorrect=@0x0)
    at slowMachine.cc:304
warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x12011f9b8
(gdb) 


Reply to: