Opened 13 years ago

Closed 13 years ago

#397 closed defect (invalid)

Valgrind reported errors

Reported by: strk Owned by: geos-devel@…
Priority: major Milestone:
Component: Default Version: main
Severity: Unassigned Keywords:
Cc:

Description

A single test from tests/buffer.xml (case 18) triggers 228 conditional jumps based on uninitialized value errors:

==21472== Conditional jump or move depends on uninitialised value(s)
==21472==    at 0x509C078: geos::geom::Coordinate::equals2D(geos::geom::Coordinate const&) const (Coordinate.inl:86)
==21472==    by 0x509C474: geos::geom::operator==(geos::geom::Coordinate const&, geos::geom::Coordinate const&) (Coordinate.inl:166)
==21472==    by 0x50B6CD0: geos::algorithm::LineIntersector::computeEdgeDistance(geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&) (LineIntersector.cpp:64)
==21472==    by 0x50B76B7: geos::algorithm::LineIntersector::getEdgeDistance(int, int) const (LineIntersector.cpp:187)
==21472==    by 0x510CC5C: geos::geomgraph::Edge::addIntersection(geos::algorithm::LineIntersector*, int, int, int) (Edge.cpp:165)
==21472==    by 0x510CBE6: geos::geomgraph::Edge::addIntersections(geos::algorithm::LineIntersector*, int, int) (Edge.cpp:149)
==21472==    by 0x5138A18: geos::geomgraph::index::SegmentIntersector::addIntersections(geos::geomgraph::Edge*, int, geos::geomgraph::Edge*, int) (SegmentIntersector.cpp:175)
==21472==    by 0x5137E73: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (MonotoneChainEdge.cpp:129)
==21472==    by 0x5138022: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (MonotoneChainEdge.cpp:157)
==21472==    by 0x5138022: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (MonotoneChainEdge.cpp:157)
==21472==    by 0x5137E01: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, geos::geomgraph::index::MonotoneChainEdge const&, int, geos::geomgraph::index::SegmentIntersector&) (MonotoneChainEdge.cpp:119)
==21472==    by 0x513A345: geos::geomgraph::index::MonotoneChain::computeIntersections(geos::geomgraph::index::MonotoneChain*, geos::geomgraph::index::SegmentIntersector*) (MonotoneChain.h:58)

Change History (11)

comment:1 by strk, 13 years ago

Summary: Conditional jump or move depends on uninitialised value(s)Valgrind reported errors with -O0
Version: 3.0.3svn-trunk

Seems to only happen when building with -O0. The previous report was on a 64bit system, on a 32bit (with -O0) it's even worst:

==21569== Invalid read of size 4
==21569==    at 0x41544F6: geos::algorithm::LineIntersector::intersection(geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate&) const (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x4153831: geos::algorithm::LineIntersector::computeIntersect(geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41526F6: geos::algorithm::LineIntersector::computeIntersection(geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&, geos::geom::Coordinate const&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41A7FA8: geos::geomgraph::index::SegmentIntersector::addIntersections(geos::geomgraph::Edge*, int, geos::geomgraph::Edge*, int) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41AC9B6: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41ACB4C: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41ACB4C: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, int, geos::geomgraph::index::MonotoneChainEdge const&, int, int, geos::geomgraph::index::SegmentIntersector&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41AC94E: geos::geomgraph::index::MonotoneChainEdge::computeIntersectsForChain(int, geos::geomgraph::index::MonotoneChainEdge const&, int, geos::geomgraph::index::SegmentIntersector&) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41ABD88: geos::geomgraph::index::MonotoneChain::computeIntersections(geos::geomgraph::index::MonotoneChain*, geos::geomgraph::index::SegmentIntersector*) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41ABB7B: geos::geomgraph::index::SimpleMCSweepLineIntersector::processOverlaps(int, int, geos::geomgraph::index::SweepLineEvent*, geos::geomgraph::index::SegmentIntersector*) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41ABAC7: geos::geomgraph::index::SimpleMCSweepLineIntersector::computeIntersections(geos::geomgraph::index::SegmentIntersector*) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==    by 0x41AB6C9: geos::geomgraph::index::SimpleMCSweepLineIntersector::computeIntersections(std::vector<geos::geomgraph::Edge*, std::allocator<geos::geomgraph::Edge*> >*, std::vector<geos::geomgraph::Edge*, std::allocator<geos::geomgraph::Edge*> >*, geos::geomgraph::index::SegmentIntersector*) (in /usr/src/geos/build-O0/src/.libs/libgeos-3.3.0.so)
==21569==  Address 0xbec49f68 is just below the stack ptr.  To suppress, use: --workaround-gcc296-bugs=yes
==21569== 

comment:2 by strk, 13 years ago

Passing --workaround-gcc296-bugs=yes to valgrind 3.6.0.SVN-Debian on the 32bit system suppressed them all.

comment:3 by mloskot, 13 years ago

Sandro, this report is incomplete and does not say what version of GCC you are using, so the use of gcc296 workaround is confusing.

comment:4 by strk, 13 years ago

Yeah, sorry. The 32bit system is using gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

The 64bit is currently off, will update on next boot

comment:5 by strk, 13 years ago

Ok, the 64bit system has the same compiler version:

  gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

And the same valgrind version too:

  valgrind-3.6.0.SVN-Debian

comment:6 by strk, 13 years ago

Summary: Valgrind reported errors with -O0Valgrind reported errors

So, on the 64bit I have "Conditional jump" when building with -O0 and "Invalid read of size 8" when building with -O2, so is _affected_ by optimization but not caused by a single optimization value :/

comment:7 by darkblueb, 13 years ago

Linux xps-420 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux dbb@xps-420:/home/shared/srcs_xps/strk_test$ gcc --version gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

dbb@xps-420:/home/shared/srcs_xps/strk_test$ valgrind --version valgrind-3.6.0.SVN-Debian ============================ dbb@xps-420:/home/shared/srcs_xps/strk_test$ libtool --mode=execute valgrind ../geos_trunk/tests/xmltester/XMLTester bug397.xml ==7815== Memcheck, a memory error detector ==7815== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==7815== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==7815== Command: /home/shared/srcs_xps/geos_trunk/tests/xmltester/.libs/lt-XMLTester bug397.xml ==7815== Files: 1 Tests: 1 Failed: 0 Succeeded: 1 ==7815== ==7815== HEAP SUMMARY: ==7815== in use at exit: 0 bytes in 0 blocks ==7815== total heap usage: 25,343 allocs, 25,343 frees, 1,213,252 bytes allocated ==7815== ==7815== All heap blocks were freed -- no leaks are possible ==7815== ==7815== For counts of detected and suppressed errors, rerun with: -v ==7815== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

comment:8 by strk, 13 years ago

--workaround-gcc296-bugs=yes on the 64bit system has no effect

comment:9 by strk, 13 years ago

Same Invalid read of size 8 on the 64bit system with g++-4.3 (Ubuntu 4.3.4-10ubuntu1) 4.3.4 this is as of r3256

comment:10 by strk, 13 years ago

Found that the errors are NOT output, on the 64bit system, unless --enable-glibcxx-debug configure switch is given.

comment:11 by strk, 13 years ago

Resolution: invalid
Status: newclosed

this was a compiler issue after all

Note: See TracTickets for help on using tickets.