Skip to content

New GCC 8.1 warnings #1002

@ArchangeGabriel

Description

@ArchangeGabriel

Environment Information

  • What platform are you using? (please provide specific distribution/version in summary)
    • Linux
  • 32 and/or 64 bit?
    • 64-bit
  • What build system are you using?
    • autotools (configure)
    • cmake

Summary of Issue

Building 4.6.1 with GCC 8.1.0 yields new warnings:

/build/netcdf/src/netcdf-c-4.6.1/libdispatch/ncuri.c: In function ‘ncuriparse’:
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/ncuri.c:153:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(uri,uri0,len0+1);
     ^~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/ncuri.c:137:12: note: length computed here
     len0 = strlen(uri0);
            ^~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/drc.c: In function ‘rcsearch’:
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/drc.c:402:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(path,prefix,pathlen);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/drc.c:395:16: note: length computed here
     int plen = strlen(prefix);
                ^~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/dauth.c: In function ‘NC_combinehostport’:
/build/netcdf/src/netcdf-c-4.6.1/libdispatch/dauth.c:79:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(hp,host,len);
     ^~~~~~~~~~~~~~~~~~~~
In function ‘mergedods1.isra.1’,
    inlined from ‘ocddsdasmerge’ at /build/netcdf/src/netcdf-c-4.6.1/oc2/ocnode.c:335:2:
/build/netcdf/src/netcdf-c-4.6.1/oc2/ocnode.c:405:6: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
      strncpy(newname,dods->name,len);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/oc2/ocnode.c: In function ‘ocddsdasmerge’:
/build/netcdf/src/netcdf-c-4.6.1/oc2/ocnode.c:400:28: note: length computed here
                          + strlen(dods->name)
                            ^~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/ncgen/util.c: In function ‘pooldup’:
/build/netcdf/src/netcdf-c-4.6.1/ncgen/util.c:472:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(sdup,s,(strlen(s)+1));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/ncgen/util.c:472:21: note: length computed here
     strncpy(sdup,s,(strlen(s)+1));
                     ^~~~~~~~~
In function ‘name_path’,
    inlined from ‘main’ at /build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:2292:30:
/build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:182:12: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     (void) strncpy(new, cp, strlen(cp) + 1); /* copy last component of path */
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c: In function ‘main’:
/build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:182:29: note: length computed here
     (void) strncpy(new, cp, strlen(cp) + 1); /* copy last component of path */
                             ^~~~~~~~~~
In function ‘adapt_url_for_cache’,
    inlined from ‘main’ at /build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:2303:7:
/build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:2106:5: warning: ‘strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncat(path, prefix, strlen(prefix));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netcdf/src/netcdf-c-4.6.1/ncdump/ncdump.c:2107:5: warning: ‘strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncat(path, tmp_path, strlen(tmp_path));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions