I'm compiling some C code (will provide link if really necessary) using GCC 8.2.0 on Linux, and using GCC 8.1.0 on Cygwin (the latter is an automated CI build).
On Linux, everything passes fine. On Cygwin, I get - among others - the following warnings:
C:\Users\travis\build\eyalroz\ssb-dbgen\src\bm_utils.c: In function 'e_str':
C:\Users\travis\build\eyalroz\ssb-dbgen\src\bm_utils.c:199:5: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
strncpy(dest + loc, strtmp, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\travis\build\eyalroz\ssb-dbgen\src\bm_utils.c:197:11: note: length computed here
len = strlen(strtmp);
^~~~~~~~~~~~~~
and
C:\Users\travis\build\eyalroz\ssb-dbgen\src\build.c:697:5: warning: 'strncpy' specified bound 10 equals destination size [-Wstringop-truncation]
strncpy(d->dayofweek, weekday_names[d->daynuminweek-1],D_DAYWEEK_LEN+1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\travis\build\eyalroz\ssb-dbgen\src\build.c:698:5: warning: 'strncpy' specified bound 10 equals destination size [-Wstringop-truncation]
strncpy(d->month,month_names[d->monthnuminyear-1],D_MONTH_LEN+1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm not doing anything, as far as I can tell, which should cause different compilation flags in both cases. Why am I getting the warnings only in one environment? Could it be the GCC version?