dear all,

i am turning to the email since it would be almost impossible to make a
regular bug report.

we are building a large c++ software for the international pierre auger
collaboration which has build the world's largest cosmic ray detector.

more than a year ago we have come across a bug (on i386 linux platforms)
but lately with gcc versions > 4 this bug seems to be occuring only on
amd64 platforms and ONLY with the -O2 level of optimization (it goes
away with -O1).

trying out a small program that supposedly captures the situation does
not reproduce it, but what is interesting it always appears in the same
context of our iterators. example:

class Foo;
class FooIterator;
class FooConstIterator;

class FooContainer {
public:
  FooIterator Begin();
  FooConstIterator Begin() const;
  FooIterator End();
  FooConstIterator End() const;
};


void
test(const FooContainer& foo)
{
  for (FooConstIterator it = foo.Begin();
       it != foo.End(); ++it) {
    // print the condition
    cout << (it != foo.End()) << endl;
    ...
  }
}

calling test prints out

0
0
0
1
0
segfault crash etc..

it seems that with -O2 and when foo is const class, the (it !=
foo.End()) is optimized away as also const (equal true) and the loop
does not end, runs over and (usually) produces segfault...

can we do something? as i mentioned. a small prove-of-bug program is
almost impossible to construct since it appears only in large contexts...

please let me know how we can proceed.

best,
-- 
darko.

doc.dr. Darko Veberic --------------
Forschungszentrum Karlsruhe   _|____
Institut fuer Kernphysik       |
Bau 425, POB 3640              |
D-76021 Karlsruhe, Germany    _ ____
mobile: +49 1515 99 55087      |
.phone: +49 7247 82 3870       |
...fax: +49 7247 82 4075
------------------------------------
Laboratory for Astroparticle Physics
University of Nova Gorica
Vipavska 13, POB 301
SI-5001 Nova Gorica, Slovenia
mobile: +386 41 860 861
.phone: +386 5 3315 255
...fax: +386 5 3315 385
------------------------------------

Reply via email to