Opened 14 months ago
Closed 12 months ago
#5558 closed defect (fixed)
Compilation warning: uninitialized variable
Reported by: | laurenz | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.4.1 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description (last modified by )
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.flags
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 cannot suggest a patch, because I don't know to what value the flags
should be initialized.
Change History (7)
comment:1 by , 14 months ago
Description: | modified (diff) |
---|
comment:2 by , 14 months ago
Description: | modified (diff) |
---|
comment:3 by , 12 months ago
comment:4 by , 12 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 12 months ago
I should note that stable-3.3 is already initializing that flag to 0 which was done by paul with [6aa0f6be9f/git]
Note:
See TracTickets
for help on using tickets.
I guess the intention there was to initialize to zero, judging from the FLAGS_SET_GEODETIC(gbox.flags, 0) which would have no other effects, given the definition of the macro uses bitwise OR… (that line should be replaced by initialization)