We recently upgraded the gcc compiler from 2.96 to the current version 3.4.1. Parts of GEANT4 do not compile, due to a problem in G4Allocator.hh, line 165. The error message is "aggregate value used where an integer was expected" Any ideas? Thank you.
I changed G4Allocator.hh to work for me, by replacing the following lines: // The gcc-3.1 compiler will complain and not correctly handle offsets // computed from non-POD types. Pointers to member data should be used // instead. This C++ feature seems not to work on earlier versions of // the same compiler. // #if (__GNUC__==3) && (__GNUC_MINOR__>0) Type G4AllocatorUnit<Type>::*pOffset = &G4AllocatorUnit<Type>::fElement; fUnit = (G4AllocatorUnit<Type> *) ((char *)anElement - size_t(pOffset)); #else fUnit = (G4AllocatorUnit<Type> *) ((char *) anElement - offsetof(G4AllocatorUnit<Type>, fElement)); #endif with the following: fUnit = (G4AllocatorUnit<Type> *) ((char *) anElement + ((char *) fUnit - (char*) &(fUnit->fElement))); I put a patchfile at http://rickard.holmberg.homeip.net/G4Allocator.patch
Geant4 6.2 is NOT ported on gcc-3.4.X. See the release notes for the list of compilers supported. Porting on the new gcc compiler will be implemented for future releases, where a new implementation of G4Allocator will be provided.
*** Bug 678 has been marked as a duplicate of this bug. *** *** 'Gabriele.Cosmo@cern.ch' will be responsible for bug 678. ***