Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-18219

"control reaches end of non-void function" errors in GCC with WCE retry loop

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.0.9, 3.1.3
    • Replication
    • None
    • Fully Compatible
    • ALL
    • Hide

      Scons invocation:

      scons -j24 CC=gcc-5 CXX=g++-5 --cache --dbg=on --opt=off --cache-dir=/media/amidvidy/scons_cache/cache --ssl CCFLAGS="-fuse-ld=gold -fdiagnostics-color=always" mongod

      Show
      Scons invocation: scons -j24 CC=gcc-5 CXX=g++-5 --cache --dbg=on --opt=off --cache-dir=/media/amidvidy/scons_cache/cache --ssl CCFLAGS="-fuse-ld=gold -fdiagnostics-color=always" mongod
    • Platform 3 05/15/15

    Description

      When the entire function is wrapped in a WCE retry-loop GCC doesn't deduce that a return statement will be reached.

      Error:

      src/mongo/db/repl/minvalid.cpp: In function 'bool mongo::repl::getInitialSyncFlag()':
      src/mongo/db/repl/minvalid.cpp:95:5: error: control reaches end of non-void function [-Werror=return-type]
           }
           ^
      src/mongo/db/repl/sync.cpp: In member function 'virtual bool mongo::repl::Sync::shouldRetry(mongo::OperationContext*, const mongo::BSONObj&)':
      src/mongo/db/repl/sync.cpp:158:5: error: control reaches end of non-void function [-Werror=return-type]
           }
           ^
      

      Apparently this was happening with gcc 4.9 as well according to spencer.

      Toolchain: gcc 5.1.0 obtained from ubuntu-toolchain-test ppa

      g++-5 -v
      gcc version 5.1.0 (Ubuntu 5.1.0-0ubuntu11~14.04.1) 
      

      Note that this only happens on debug builds.

      Attachments

        Issue Links

          Activity

            People

              adam.midvidy Adam Midvidy
              adam.midvidy Adam Midvidy
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: