Problem 18 - Bug in stl_hash_fun.h for egcs compiler
Summary: Bug in stl_hash_fun.h for egcs compiler
Status: CLOSED LATER
Alias: None
Product: Geant4
Classification: Unclassified
Component: global (show other problems)
Version: 0.1
Hardware: PC Linux
: P2 normal
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 1999-10-06 09:36 CEST by John.Allison
Modified: 2000-02-02 09:48 CET (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description John.Allison 1999-10-06 09:36:06 CEST
egcs-1.1.1 and egcs-1.1.2 require a change to the system file stl_hash_fun.h.
This is from our release notes:

>  >       In order to compile with STL it is necessary to edit
>  >       stl_hash_fun.h in /usr/include/g++/ or /usr/local/include/g++/.
>  >       Lines 65-67 must be removed or commented out.  These are the
>  >       lines in question:
>  >
>  >         __STL_TEMPLATE_NULL struct hash<signed char> {
>  >           size_t operator()(unsigned char x) const { return x; }
>  >         };

Hajime has found that egcs-1.1.2 and SGI-STL-v3.2 is OK, so an alternative
is to load SGI-STL-v3.2.

g++-2.95.1, which is the next version of g++ and which subsumes egcs, has
SGI-STL-v3.2 but has other problems with Geant4.

Our strategy is to fix things for egcs-1.1.1 and egcs-1.1.2 and wait for
a stable version of the new g++.
Comment 1 Gabriele Cosmo 1999-10-12 13:45:59 CEST
Problem will probably go away as soon as usage of RW hash dictionaries will be
removed from the code and replaced by STL map/multimap/set containers. To be
expected together with the migration to ISO/ANSI C++.
Comment 2 John.Allison 1999-10-18 10:04:59 CEST
The following error report has been sent to egcs people by Hajime Yoshida:

I have a problem in using SGI-STL's stl_hash_fun.h.

A) platform = g++-2.95.1 ( with SGI-STL v.3.2) and Debian-2.1 Linux (Redhat-5.2,
too)

B) error
'../include/g++-3/stl_hash_fun.h:65: redefinition of `struct hash<char>'
../include/g++-3/stl_hash_fun.h:61: previous definition here
../include/g++-3/stl_hash_fun.h:65: explicit specialization of non-template
`hash<char>'
../include/g++-3/stl_hash_fun.h:67: confused by earlier errors, bailing out

C) History
1) The same error was seen with egcs-1.1.2/1.1.1 + SGI-STL v3.1.x
        (default distribution of Debian or Redhat)

2) The error vanished with egcs-1.1.2/1.1.1 + SGI-STL v3.2

3) The error reappeared with gcc-2.95.1 which has SGI-STL v3.2.
Comment 3 John.Allison 1999-10-28 08:58:59 CEST
We still haven't heard from egcs so problem remains RESOLVED/LATER
but there is recognition that this is a
bug in the compiler.  As a workaround at CERN the CERN-wide version of
stl_hash_fun.h has been modified, by courtesy Philippe Defert (thanks,
Philippe) and tested by Maya Stavrianakou (thanks, Maya).

From Maya Stavrianakou:
I have rebuilt everything (incl. visualisation, excl. persistency) with
G4USE_STL=1 using the standard stl_hash_fun.h from the public
(/asis/i386_redhat51/usr.local/include/g++) /usr/local/include/g++/. I've
also rebuilt and run my example for 1000 events.

For speed, I rebuilt on my desktop Linux (pcatlas125) which is standard -
the same environment as the ATLAS Linux wgs.

Everything seemed to work fine!
Thanks!
Comment 4 John.Allison 1999-10-28 09:03:59 CEST
We still haven't heard from egcs so the problem remains RESOLVED LATER, but
there is now a workaround for CERN by virtue of a modified CERN-wide version
of stl_hash_fun.h, courtesy Philippe Defert (thanks, Philippe).  It has been
tested by Maya Stavrianakou (thanks, Maya):

I have rebuilt everything (incl. visualisation, excl. persistency) with
G4USE_STL=1 using the standard stl_hash_fun.h from the public
(/asis/i386_redhat51/usr.local/include/g++) /usr/local/include/g++/. I've
also rebuilt and run my example for 1000 events.

For speed, I rebuilt on my desktop Linux (pcatlas125) which is standard -
the same environment as the ATLAS Linux wgs.

Everything seemed to work fine!
Thanks!