Hello,

for some time now I had problems with one of my projects with compilers gcc
4.2.1 and above. For obscure reasons my testsuite did not run correctly when I
did compile with optimization enabled. I now tracked the problem down
to a very strange bug that I can reproduce with a test case that I will 
attach. The problem I encounter is the fact that inserting duplicated values
into a std::set will end up with a set holding these values more than once.
This happens only with optimization enabled.

I was able to prevent the problem in the test case by means of just
moving the function that would create the error further away from
the position where the function is called. In the test case the offset is
created by means of another function that is not used, and that can be removed
from the object file by means of compiler macros. 

If the unused function is part of the object file, then the std::set
manipulation runs fine, if the function is disabled and removed from the object
file the manipulation of the std::set fails. The function is inserted into the
object file by means of defining the precompiler macro MAKEOFFSET.

Kind regards,


-- 
           Summary: compiler produces wrong code when optimizing
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roebel at ircam dot fr
 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=34992

Reply via email to