------- Additional Comments From ctsa at u dot washington dot edu 2005-02-07 23:12 ------- (In reply to comment #0) > 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 <cstring> > #include <map> > #include <utility> > > 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<const char*,char,ltstr> lup_map; > > const static pair<const char*,char> 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
Note that that's any value for inline-limit equal to or GREATER than 604. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19813