I took this piece of code out of a a project I'm working on: #include <string.h> #include <unistd.h> #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip_icmp.h> struct packet { struct icmp hdr; }; int main() { struct packet pckt; memset(&pckt.icmp_data, 0, 0); return 0; } When compiling this with gcc8 on FreeBSD 12.0-RELEASE I get following error: bug.c: In function 'main': bug.c:14:14: error: 'struct packet' has no member named 'icmp_dun' memset(&pckt.icmp_data, 0, 0); gcc is correct in detecting an error since packet indeed has no member "icmp_data" but the error message says "icmp_dun" which appears to come from nowhere. Unfortunately my only system right now is FreeBSD so couldn't check on other OSes. Thanks, Michael
My system info and gcc info: $> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc8/gcc/x86_64-portbld-freebsd12.0/8.2.0/lto-wrapper Target: x86_64-portbld-freebsd12.0 Configured with: /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.2.0/configure --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc8 --libexecdir=/usr/local/libexec/gcc8 --program-suffix=8 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc8/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --enable-languages=c,c++,objc,fortran --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/share/info/gcc8 --build=x86_64-portbld-freebsd12.0 Thread model: posix gcc version 8.2.0 (FreeBSD Ports Collection) $> freebsd-version 12.0-RELEASE
Compile command is simply: gcc bug.c
There isn't much GCC could do differently here, for netinet/ip_icmp.h that your example includes has the following line: #define icmp_data icmp_dun.id_data In other words, this is not really a GCC issue, but a direct result of how the FreeBSD system headers are implemented. In general, for reports that are not FreeBSD-specific, please consider reporting them upstream, cf. https://gcc.gnu.org/bugs/ .