GnuCash
Contact   Instructions
Bug 797356 - ninja check fails with GCC-9
Summary: ninja check fails with GCC-9
Status: VERIFIED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Build system (show other bugs)
Version: 3.6
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-18 22:56 EDT by Dmitry Smirnov
Modified: 2019-09-09 18:24 EDT (History)
5 users (show)

See Also:


Attachments

Description Dmitry Smirnov 2019-08-18 22:56:56 EDT
As reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925700
GnuCash 3.6 FTBFS when built by GCC-9:

~~~~
cd /build/gnucash-3.6/.build/libgnucash/engine/test && /usr/lib/ccache/c++  -DHAVE_CONFIG_H -DHAVE_GUILE22 -D_GNU_SOURCE -I/build/gnucash-3.6/libgnucash/engine -I/build/gnucash-3.6/libgnucash/core-utils -I/build/gnucash-3.6/.build/common -I/build/gnucash-3.6/common -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/build/gnucash-3.6/.build/__gtest/googletest/include -I/build/gnucash-3.6/libgnucash/engine/test/../../../borrowed/libc  -Wno-error=deprecated-declarations  -Werror -Wall -Wmissing-declarations -Wno-unused -Wno-error=parentheses -std=gnu++11 -g -O2 -fdebug-prefix-map=/build/gnucash-3.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG   -o CMakeFiles/test-gnc-datetime.dir/__/gnc-date.cpp.o -c /build/gnucash-3.6/libgnucash/engine/gnc-date.cpp                                                                                                   
In file included from /usr/include/string.h:494, 
                 from /usr/include/glib-2.0/glib/gtestutils.h:30, 
                 from /usr/include/glib-2.0/glib.h:85, 
                 from /build/gnucash-3.6/libgnucash/engine/gnc-date.cpp:33: 
In function 'char* strncpy(char*, const char*, size_t)', 
    inlined from 'size_t qof_print_date_buff(char*, size_t, time64)' at /build/gnucash-3.6/libgnucash/engine/gnc-date.cpp:562:16, 
    inlined from 'char* qof_print_date(time64)' at /build/gnucash-3.6/libgnucash/engine/gnc-date.cpp:594:25: 
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 34 equals destination size [-Werror=stringop-truncation]                                                                                                          
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); 
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
~~~~


See also http://gcc.gnu.org/gcc-9/porting_to.html
Comment 1 Frank H. Ellenberger 2019-09-05 02:36:30 EDT
I can confirm this issue.
Comment 2 John Ralls 2019-09-09 18:07:55 EDT
Hmmph, I can't. I tried Debian Sid (gcc-9.2.1) and Arch (gcc-9.1.0). On the former I even tried explicitly setting -Wstringop-truncation.

But just to be safe I've edited all of the calls to qof_print_gdate, qof_print_date_dmy_buff, and qof_print_date_buff to ensure that the buffer size is MAX_DATE_LENGTH + 1 and that len passed to the function is MAX_DATE_LENGTH.

Note You need to log in before you can comment on or make changes to this bug.