Problem 174

Summary: Problem with operator new
Product: Geant4 Reporter: vb
Component: configAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 2.0   
Hardware: DEC   
OS: OSF/1   

Description vb 2000-11-27 02:36:23 CET
Hi,

I'm using egcs.1.1.2 on a DECalpha station running Tru64 V4.0D to
compile the GEANT4 source code.
I get the following error message:

-------------------------------------------------
Compiling G4LPhysicsFreeVector.cc ...
<internal>: In function `void construct<G4double, double>(G4double *,
const double &)':
/software/OSF1/include/g++/stl_vector.h:146:   instantiated from
`vector<double,__default_alloc_template<false,0> >::push_back<G4double,
alloc>(const G4double &)'
/cern/GEANT4/geant4.2.0/source/global/STLInterface/g4rw/tvordvec.icc:224:

instantiated from `G4RWTValOrderedVector<double>::resize<G4double>
(long unsigned int)'
src/G4LPhysicsFreeVector.cc:44:   instantiated from here
<internal>:45: too many arguments to function
`operator new(long unsigned int)'
/software/OSF1/include/g++/stl_construct.h:45: at this point in file
gmake[2]: *** [/cern/GEANT4/geant4.2.0/tmp/DEC-g++/
G4globman/G4LPhysicsFreeVector.o] Error 1
---------------------------------------------------

which originates from a statement in stl_construct.h saying:
  new (p) T1(value);

In stl_construct.h a file <new> is included, with the following content:

****************************************************
// The -*- C++ -*- dynamic memory management header.
// Copyright (C) 1994, 1996 Free Software Foundation

#ifndef __NEW__
#define __NEW__

#pragma interface "new"
#include <stddef.h>
#include <exception>

extern "C++" {

#ifdef __HONOR_STD
namespace std {
#endif

  class bad_alloc : public exception {
  public:
    virtual const char* what() const throw() { return "bad_alloc"; }
  };

  struct nothrow_t {};
  extern const nothrow_t nothrow;
  typedef void (*new_handler)();
  new_handler set_new_handler (new_handler);

#ifdef __HONOR_STD
} // namespace std
#endif

// replaceable signatures
void *operator new (size_t) throw (std::bad_alloc);
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const std::nothrow_t&) throw();
void *operator new[] (size_t, const std::nothrow_t&) throw();
void operator delete (void *, const std::nothrow_t&) throw();
void operator delete[] (void *, const std::nothrow_t&) throw();

// default placement versions of operator new
inline void *operator new(size_t, void *place) throw() { return place; }

inline void *operator new[](size_t, void *place) throw() { return place;
}
} // extern "C++"

#endif
********************************************


My C++ is not fluent enough to debug this.
Can you give me a hint??

Thanks,

Victor Bom
Delft University of Technology
vb@iri.tudelft.nl
Comment 1 Gabriele Cosmo 2000-12-14 07:32:59 CET
As you probably know, on DEC we only support the native compiler cxx v.6.1.
We do not support g++ other than for Linux. We experienced several times
problems correlated to incompatibilities of system files and GNU software
on non-Linux platforms.
The only suggestion I can give to you is to try to compile using -ansi and
-DG4USE_STD_NAMESPACE to force ISO/ANSI implementation of STL.