This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Possible bug in C++, can someone else verify?
- From: Patrick Audley <paudley at compbio dot dundee dot ac dot uk>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 17 Sep 2003 17:14:53 +0100
- Subject: Possible bug in C++, can someone else verify?
With a recent debian gcc (3.3.2 20030908) we can no longer compile a
bit of code with optimizations. Can someone else verify that this
fails with 3.3.2 or a newer compiler? 3.3 seems to work perfectly for
me.
Is this valid C++?
----------8<-----------------------------
#include <vector>
struct blc_offset {
long start;
};
int main(void) {
std::vector<blc_offset> vec;
blc_offset b_off;
b_off.start = 1;
vec.push_back( b_off );
vec[0].start = vec[0].start == 0 ? 0 : vec[0].start - 1;
}
---------------------->8-----------------
when compiled with v3.3 at -O3 it runs fine, on v3.3.2 (debian
pre-release) it hangs in stl_vector.h somewhere in the template.
Thanks,
Patrick.
--
Patrick Audley paudley@compbio.dundee.ac.uk
Computational Biology & Bioinformatics http://www.compbio.dundee.ac.uk
University of Dundee http://blackcat.ca
Dundee, Scotland +44 1382 348721