From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4099 invoked by alias); 7 Feb 2005 23:09:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4013 invoked by uid 48); 7 Feb 2005 23:09:35 -0000 Date: Tue, 08 Feb 2005 10:42:00 -0000 From: "ctsa at u dot washington dot edu" To: gcc-bugs@gcc.gnu.org Message-ID: <20050207230934.19813.ctsa@u.washington.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19813] New: gcc 4.0 regression: bad code generation?? due to inlining?? X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg00471.txt.bz2 List-Id: I'm getting a segfault on what I believe to be valid code using gcc 4.0 but not when using gcc 3.4 or 3.3. I've reduced this situation down to a relatively short testcase file, details follow. testcase.cc: """ #include #include #include using namespace std; struct ltstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; char codon_trans_known(const char*c){ typedef map lup_map; const static pair tab_tmp[] = { make_pair("TTT",'F'),make_pair("TCT",'S'),make_pair("TAT",'Y'),make_pair("TGT",'C'), make_pair("TTC",'F'),make_pair("TCC",'S'),make_pair("TAC",'Y'),make_pair("TGC",'C'), make_pair("TTA",'L'),make_pair("TCA",'S'),make_pair("TAA",'*'),make_pair("TGA",'*'), make_pair("TTG",'L'),make_pair("TCG",'S'),make_pair("TAG",'*'),make_pair("TGG",'W'), make_pair("CTT",'L'),make_pair("CCT",'P'),make_pair("CAT",'H'),make_pair("CGT",'R'), make_pair("CTC",'L'),make_pair("CCC",'P'),make_pair("CAC",'H'),make_pair("CGC",'R'), make_pair("CTA",'L'),make_pair("CCA",'P'),make_pair("CAA",'Q'),make_pair("CGA",'R'), make_pair("CTG",'L'),make_pair("CCG",'P'),make_pair("CAG",'Q'),make_pair("CGG",'R'), make_pair("ATT",'I'),make_pair("ACT",'T'),make_pair("AAT",'N'),make_pair("AGT",'S'), make_pair("ATC",'I'),make_pair("ACC",'T'),make_pair("AAC",'N'),make_pair("AGC",'S'), make_pair("ATA",'I'),make_pair("ACA",'T'),make_pair("AAA",'K'),make_pair("AGA",'R'), make_pair("ATG",'M'),make_pair("ACG",'T'),make_pair("AAG",'K'),make_pair("AGG",'R'), make_pair("GTT",'V'),make_pair("GCT",'A'),make_pair("GAT",'D'),make_pair("GGT",'G'), make_pair("GTC",'V'),make_pair("GCC",'A'),make_pair("GAC",'D'),make_pair("GGC",'G'), make_pair("GTA",'V'),make_pair("GCA",'A'),make_pair("GAA",'E'),make_pair("GGA",'G'), make_pair("GTG",'V'),make_pair("GCG",'A'),make_pair("GAG",'E'),make_pair("GGG",'G')}; const static int tsize = sizeof(tab_tmp)/sizeof(tab_tmp[0]); const static lup_map codon_table1(tab_tmp,tab_tmp+tsize); lup_map::const_iterator s=codon_table1.find(c); if( s != codon_table1.end() ){ return s->second; } else { return 'X'; } } main(){ char a = codon_trans_known("AAA"); } """ when I build with the following optimizations: g++ -O2 -finline-functions -finline-limit=604 testcase.cc ...I get a segfault with any value of inline-limit =< 604 . This only occurs with -O2 or -O3, so I haven't been able to get a meaningful backtrace either. All I can tell is that an invalid char pointer has been passed to the strcmp call in ltstr. I'm using this week's gcc snapshot: $ gcc -v Using built-in specs. Configured with: /home/ctsa/tmp/gcc-4.0-20050130/configure --disable-checking --prefix=/home/ctsa/opt/i686-linux/gcc-4.0-20050130 --enable-concept-checks --enable-languages=c,c++ --enable-__cxa_atexit Thread model: posix gcc version 4.0.0 20050130 (experimental) I've also observed this problem with last week's snapshot build of 4.0 (20050123), but cannot replicate this with 3.4.3 or 3.3.5 -- Summary: gcc 4.0 regression: bad code generation?? due to inlining?? Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ctsa at u dot washington dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19813