Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3900 closed defect (fixed)

type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Reported by: strk Owned by: pramsey
Priority: high Milestone: PostGIS 2.5.0
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

Recently introduced:

g_serialized.c: In function ‘gserialized_cmp’:
g_serialized.c:308:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   *(uint32_t*)(g1->data) == POINTTYPE &&
   ^
g_serialized.c:309:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   *(uint32_t*)(g2->data) == POINTTYPE &&
   ^

strict aliasing rules are there so you don't assume it is safe to cast to pointers to structors of different alignemnt constraints.

Change History (4)

comment:2 by strk, 7 years ago

Resolution: fixed
Status: newclosed

In 15976:

Fix GCC warnings

Obey const pointer in autofix logic.
Move ring closing logic to ptarray_to_GEOSCoordSeq.
Fix memory access.

Patch by Darafei Praliaskouski <me@…>

Fixes #3900

comment:3 by robe, 7 years ago

Milestone: PostGIS 2.4.1PostGIS 2.5.0

This was marked for 2.4.1 release but was not back-ported to 2.4.1. I've change the milestone to 2.5.0. If this is wrong, fix in 2.4.1 and change milestone back.

comment:4 by dbaston, 7 years ago

Is there a reason not to backport this? I'm still getting this error when building the 2.4 branch.

Version 0, edited 7 years ago by dbaston (next)
Note: See TracTickets for help on using tickets.