[postgis-tickets] [PostGIS] #3900: type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

PostGIS trac at osgeo.org
Thu Oct 12 08:51:11 PDT 2017


#3900: type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
---------------------+---------------------------
 Reporter:  strk     |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  high     |  Milestone:  PostGIS 2.4.1
Component:  postgis  |    Version:  2.4.x
 Keywords:           |
---------------------+---------------------------
 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.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3900>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list