Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

build fails in Release mode #127

Description

@bhatiaharsh

Hi,

I am able to successfully build the databroker, but that is possible only in the Debug mode. In the Release mode, I hit the following format conversion error. This error was introduced in gcc@7.1, so for newer compilers, the code will fail (I am using gcc@7.3.1.

Scanning dependencies of target backend_common_sge_test
[ 32%] Building C object backend/common/test/CMakeFiles/backend_common_sge_test.dir/backend_common_sge_test.c.o
In file included from /g/g92/bhatia4/repo/github/data-broker/backend/common/dbbe_api.h:30:0,
                 from /g/g92/bhatia4/repo/github/data-broker/test/test_utils.h:18,
                 from /g/g92/bhatia4/repo/github/data-broker/backend/common/test/backend_common_sge_test.c:18:
/g/g92/bhatia4/repo/github/data-broker/backend/common/test/backend_common_sge_test.c: In function 'test_serialize':
/g/g92/bhatia4/repo/github/data-broker/backend/common/sge.h:86:37: error: '
   ' directive output truncated writing 1 byte into a region of size 0 [-Werror=format-truncation=]
   int plen = snprintf( data, space, "%"PRId64"\n%d\n", dbBE_SGE_get_len( sge, sge_count ), sge_count );
                                     ^~~
/g/g92/bhatia4/repo/github/data-broker/backend/common/sge.h:86:47: note: format string is defined here
   int plen = snprintf( data, space, "%"PRId64"\n%d\n", dbBE_SGE_get_len( sge, sge_count ), sge_count );
                                               ^~
/g/g92/bhatia4/repo/github/data-broker/backend/common/sge.h:86:7: note: 'snprintf' output 6 bytes into a destination of size 2
   int plen = snprintf( data, space, "%"PRId64"\n%d\n", dbBE_SGE_get_len( sge, sge_count ), sge_count );
       ^~~~
/g/g92/bhatia4/repo/github/data-broker/backend/common/sge.h:107:36: error: '%ld' directive output truncated writing 2 bytes into a region of size 1 [-Werror=format-truncation=]
     plen = snprintf( data, space, "%ld\n", itemlen );
                                    ^~~
/g/g92/bhatia4/repo/github/data-broker/backend/common/sge.h:107:10: note: 'snprintf' output 4 bytes into a destination of size 1
     plen = snprintf( data, space, "%ld\n", itemlen );
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /g/g92/bhatia4/repo/github/data-broker/backend/common/test/backend_common_sge_test.c:18:0:
/g/g92/bhatia4/repo/github/data-broker/backend/common/test/backend_common_sge_test.c: In function 'test_header_extract':
/g/g92/bhatia4/repo/github/data-broker/test/test_utils.h:43:108: error: 'parsed' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define TEST( function, expect ) ( (function)==(expect)? dbrTest_util_print( #function, #expect, "==", 0 ) : dbrTest_util_print( #function, #expect, "==", 1 ) )
                                                                                                            ^
/g/g92/bhatia4/repo/github/data-broker/backend/common/test/backend_common_sge_test.c:63:10: note: 'parsed' was declared here
   size_t parsed;
          ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [backend/common/test/CMakeFiles/backend_common_sge_test.dir/build.make:63: backend/common/test/CMakeFiles/backend_common_sge_test.dir/backend_common_sge_test.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:410: backend/common/test/CMakeFiles/backend_common_sge_test.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions