Opened 16 months ago
Last modified 15 months ago
#5558 closed defect
Compilation warning: uninitialized variable — at Initial Version
Reported by: | Laurenz Albe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.4.1 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
Building master, I get
In file included from mvt.h:40, from mvt.c:30: mvt.c: In function ‘mvt_clip_and_validate_geos’: mvt.c:884:41: warning: ‘bgbox.flags’ may be used uninitialized [-Wmaybe-uninitialized] 884 | FLAGS_SET_GEODETIC(bgbox.flags, 0); ../liblwgeom/liblwgeom.h:175:95: note: in definition of macro ‘FLAGS_SET_GEODETIC’ 175 | #define FLAGS_SET_GEODETIC(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_GEODETIC) : ((flags) & ~LWFLAG_GEODETIC)) | ^~~~~ mvt.c:881:22: note: ‘bgbox’ declared here 881 | GBOX bgbox; | ^~~~~
Indeed, in postgis/mvt.c
, bgbox.flag
is not initialized:
GBOX bgbox; bgbox.xmax = bgbox.ymax = (double)extent + (double)buffer; bgbox.xmin = bgbox.ymin = -(double)buffer; FLAGS_SET_GEODETIC(bgbox.flags, 0);
I guess it should be initialized to zero, as in the following patch:
-
postgis/mvt.c
diff --git a/postgis/mvt.c b/postgis/mvt.c index 8aa916052..64bb28edb 100644
a b mvt_clip_and_validate_geos(LWGEOM *lwgeom, uint8_t basic_type, uint32_t extent, 881 881 GBOX bgbox; 882 882 bgbox.xmax = bgbox.ymax = (double)extent + (double)buffer; 883 883 bgbox.xmin = bgbox.ymin = -(double)buffer; 884 bgbox.flags = 0; 884 885 FLAGS_SET_GEODETIC(bgbox.flags, 0); 885 886 886 887 ng = mvt_unsafe_clip_by_box(ng, &bgbox);
Note:
See TracTickets
for help on using tickets.