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

"error: offset outside bounds of constant string" compiling src/mongo/bson/bson_obj_test.cpp

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide
      ubuntu@promonarchy-remi:~/mongo$ g++ -c -O2 -Werror -std=c++11 -Ibuild/opt -Isrc src/mongo/bson/bson_obj_test.cpp 
      In file included from src/mongo/db/jsobj.h:49:0,
                       from src/mongo/bson/bson_obj_test.cpp:28:
      src/mongo/bson/bsonelement.h: In member function ‘virtual void {anonymous}::UnitTest__BSONObj__getFields::_doTest()’:
      src/mongo/bson/bsonelement.h:236:23: error: offset outside bounds of constant string [-Werror]
               return data + 1;
                             ^
      cc1plus: all warnings being treated as errors
      
      Show
      ubuntu@promonarchy-remi:~/mongo$ g++ -c -O2 -Werror -std=c++11 -Ibuild/opt -Isrc src/mongo/bson/bson_obj_test.cpp In file included from src/mongo/db/jsobj.h:49:0, from src/mongo/bson/bson_obj_test.cpp:28: src/mongo/bson/bsonelement.h: In member function ‘virtual void {anonymous}::UnitTest__BSONObj__getFields::_doTest()’: src/mongo/bson/bsonelement.h:236:23: error: offset outside bounds of constant string [-Werror] return data + 1; ^ cc1plus: all warnings being treated as errors
    • Platforms 13 (04/22/16)

      This is a bit strange and it might be a compiler bug. but if you try to build mongodb on Ubuntu Xenial you get this problem. The smallest version of the code I've managed to find is http://paste.ubuntu.com/15573440/. I haven't tried using gcc tip yet, that's probably one of the next things to try.

      It happens with 3.2 and git tip.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            mwhudson Michael Hudson-Doyle
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: