Blizzard of warnings from -Wcast-align

Hal Murray hmurray at megapathdsl.net
Sun May 7 18:21:43 UTC 2017


Can these be fixed, or is it time to move -Wcast-align out of the mainline?

These are from Raspbian and/or Debian on a Raspberry Pi.  Similar happen on 
FreeBSD (Intel and RPi) and NetBSD (RPi, not Intel)

../../ntpd/ntp_control.c: In function ‘ctl_error’:
../../ntpd/ntp_control.c:714:35: warning: cast increases required alignment 
of target type [-Wcast-align]
   maclen = authencrypt(res_keyid, (uint32_t *)&rpkt,

../../ntpd/ntp_control.c: In function ‘process_control’:
../../ntpd/ntp_control.c:830:35: warning: cast increases required alignment 
of target type [-Wcast-align]
   else if (authdecrypt(res_keyid, (uint32_t *)pkt,

../../ntpd/ntp_control.c: In function ‘ctl_flushpkt’:
../../ntpd/ntp_control.c:999:10: warning: cast increases required alignment 
of target type [-Wcast-align]
          (uint32_t *)&rpkt, totlen);

../../ntpd/ntp_packetstamp.c: In function ‘fetch_packetstamp’:
../../ntpd/ntp_packetstamp.c:171:11: warning: cast increases required 
alignment of target type [-Wcast-align]
     tsp = (struct timespec *)CMSG_DATA(cmsghdr);

../../ntpd/ntp_io.c: In function ‘is_ip_address’:
../../ntpd/ntp_io.c:627:16: warning: cast increases required alignment of 
target type [-Wcast-align]
     resaddr6 = (struct sockaddr_in6 *)result->ai_addr;

../../ntpd/ntp_io.c: In function ‘process_routing_msgs’:
../../ntpd/ntp_io.c:3243:12: warning: cast increases required alignment of 
target type [-Wcast-align]
  for (nh = (struct nlmsghdr *)buffer;

../../ntpd/ntp_proto.c: In function ‘handle_fastxmit’:
../../ntpd/ntp_proto.c:507:4: warning: cast increases required alignment of 
target type [-Wcast-align]
    (uint32_t*)rbufp->recv_space.X_recv_buffer,

../../ntpd/ntp_proto.c: In function ‘handle_procpkt’:
../../ntpd/ntp_proto.c:667:6: warning: cast increases required alignment of 
target type [-Wcast-align]
     *(const uint32_t*)pkt->refid,

../../ntpd/ntp_proto.c: In function ‘receive’:
../../ntpd/ntp_proto.c:818:6: warning: cast increases required alignment of 
target type [-Wcast-align]
      (uint32_t*)rbufp->recv_space.X_recv_buffer,

../../tests/libntp/macencrypt.c: In function ‘TEST_macencrypt_DecryptValid_â
€™:
../../tests/libntp/macencrypt.c:51:26: warning: cast increases required 
alignment of target type [-Wcast-align]
                          (uint32_t*)expectedPacket, packetLength, 20));


If I comment out the cast-align, this is the only warning left.  It's from an 
old CentOS.  Anybody know what this is about?
ntp_parser.tab.c:378:6: warning: "YYENABLE_NLS" is not defined
ntp_parser.tab.c:1260:6: warning: "YYLTYPE_IS_TRIVIAL" is not defined

If we can't fix it, I can live with it like we lived with the old warning 
that I've forgotten about.  I think it was a sign/unsigned mismatch that 
couldn't be fixed due to a screwup in a system macro.



-- 
These are my opinions.  I hate spam.





More information about the devel mailing list