ardb icon indicating copy to clipboard operation
ardb copied to clipboard

ardb compile warning on GCC 8.x

Open SteveClement opened this issue 5 years ago • 0 comments

<<<<< Done building ROCKSDB
    CXX db/rocksdb/rocksdb_engine.o
    CXX config.o
    CXX cron.o
    CXX logger.o
    CXX network.o
    CXX types.o
    CXX statistics.o
statistics.cpp: In member function ‘virtual void ardb::CostTrack::Dump(void (*)(const string&, void*), void*)’:
statistics.cpp:120:44: error: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1013 [-Werror=format-truncation=]
             snprintf(tmp, sizeof(tmp) - 1, "coststat_%s_%s:calls=%" PRIu64 ",costs=%" PRIu64 ",cost_per_call=%" PRIu64 ",percents=%.4f%%", name.c_str(), range, recs[i].count,
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                ~~~~~
statistics.cpp:120:44: note: using the range [0, 18446744073709551615] for directive argument
statistics.cpp:120:44: note: assuming directive output of 6 bytes
statistics.cpp:120:21: note: ‘snprintf’ output 57 or more bytes (assuming 1083) into a destination of size 1023
             snprintf(tmp, sizeof(tmp) - 1, "coststat_%s_%s:calls=%" PRIu64 ",costs=%" PRIu64 ",cost_per_call=%" PRIu64 ",percents=%.4f%%", name.c_str(), range, recs[i].count,
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     recs[i].cost, recs[i].cost / recs[i].count, (double(recs[i].count) / double(recs[0].count)) * 100);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:177: statistics.o] Error 1
make[1]: Leaving directory '/home/steve/Desktop/code/CIRCL_Main/AIL-framework/ardb/src'
make: *** [Makefile:4: all] Error 2

Temporary fix: switch to gcc-7/g++-7 in src/Makefile Tested on Debian 9 sid (stable-updates)

SteveClement avatar Nov 27 '18 03:11 SteveClement