public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19814] New: gcc 4.0 regression: bad code generation?? due to inlining??
@ 2005-02-08 12:58 ctsa at u dot washington dot edu
2005-02-08 13:27 ` [Bug c++/19814] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: ctsa at u dot washington dot edu @ 2005-02-08 12:58 UTC (permalink / raw)
To: gcc-bugs
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
--
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=19814
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/19814] gcc 4.0 regression: bad code generation?? due to inlining??
2005-02-08 12:58 [Bug c++/19814] New: gcc 4.0 regression: bad code generation?? due to inlining?? ctsa at u dot washington dot edu
@ 2005-02-08 13:27 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-08 13:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-07 23:16 -------
*** This bug has been marked as a duplicate of 19813 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19814
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-07 23:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 12:58 [Bug c++/19814] New: gcc 4.0 regression: bad code generation?? due to inlining?? ctsa at u dot washington dot edu
2005-02-08 13:27 ` [Bug c++/19814] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).