From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,54a264adaebe90c5,start X-Google-Attributes: gid1164f8,public X-Google-Thread: 111c93,54a264adaebe90c5,start X-Google-Attributes: gid111c93,public From: Bram Subject: egcc + STL + optimize == crash? Date: 1999/01/07 Message-ID: <3694C91D.69663E88@xs4all.nl>#1/1 X-Deja-AN: 430201531 X-NNTP-Posting-Host: dc2-modem1770.dial.xs4all.nl [194.109.134.234] Content-Transfer-Encoding: 7bit X-XS4ALL-Date: Fri, 08 Jan 1999 15:55:13 CET Followup-To: comp.os.linux.alpha Content-Type: text/plain; charset=us-ascii Organization: XS4ALL, networking for the masses Mime-Version: 1.0 Newsgroups: comp.os.linux.alpha,comp.sys.dec Hello, When using STL, I get crashes when compiling for alpha -O. For intel, no problems. Without -O, also no problems. The problems start when putting a std::list in a std::hash_map and compiling -O. I checked the egcs web-page, and it's not a known-bug. Egcs recommends sending a .ii file as bug report, but as that one is over 300Kb, I thought it would not be the right thing to do. (It grows so large because of all the STL). Has anyone else experienced problems with STL and egcs? Thanks, Bram For the interested, this is the src that crashes: /* * This is the minimalized code to demonstrate an * eledged bug in egcc when putting STL-lists in an STL-hash_map * * compiler: * g++ -v * Reading specs from /usr/lib/gcc-lib/alpha-linux/egcs-2.91.57/specs * gcc version egcs-2.91.57 19980901 (egcs-1.1 release) * * cmd line: * g++ -D__STL_ASSERTIONS -Wall -ggdb -o b.out bug.cc * g++ -D__STL_ASSERTIONS -Wall -ggdb -O -Wall -ggdb bug.cc * * This code crashes severly when -O compiled. * Sometimes it may crash so hard, that gdb starts to question itself :-) * * ACTION RESULT * ---------------------------------------------------------- * Target Pentium-PRO instead dec-alpha OK * Disabling -O OK * Using a hash_map of vectors OK * Using a hash_map of lists CRASH * * Bram Stolk, stolk@sidonia.xs4all.nl (work: bram@nuson.nl) */ // It's the combination of the list and hash_map that causes troubles #include #include #include // Our hash data #if 1 typedef std::list HashData; #else typedef std::vector HashData; #endif struct eqint { bool operator()(const int s1, int s2) const { return (s1 == s2); } }; typedef std::hash_map, eqint> SectorHashMap; int main() { SectorHashMap shm; shm[12345]; return 0; }