Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#1185 closed defect

aliasing probs: rtems_glue.c

Reported by: Ralf Corsepius Owned by: Eric Norum
Priority: normal Milestone: 4.8
Component: network/legacy Version: 4.8
Severity: normal Keywords:
Cc: joel.sherrill@…, chrisj@… Blocked By:
Blocking:

Description

# <path>/configure --target=i386-rtems4.8
...
# make RTEMS_BSP=pc686 preinstall
...
# cd i386-rtems4.8/c/pc686/cpukit/libnetworking
...
# make CFLAGS="-mtune=pentiumpro -O2 -Werror -Wstrict-aliasing=2" \
rtems/libnetworking_a-rtems_glue.o
i386-rtems4.8-gcc --pipe -DHAVE_CONFIG_H -I.. -I../../cpukit/../../../pc686/lib/include -I../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -DBSD_VISIBLE -Wall -fasm -mtune=pentiumpro -O2 -Werror -Wstrict-aliasing=2 -MT rtems/libnetworking_a-rtems_glue.o -MD -MP -MF rtems/.deps/libnetworking_a-rtems_glue.Tpo -c -o rtems/libnetworking_a-rtems_glue.o test -f 'rtems/rtems_glue.c' || echo '../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/'rtems/rtems_glue.c
cc1: warnings being treated as errors
In file included from ../../cpukit/../../../pc686/lib/include/rtems/score/chain.h:173,

from ../../cpukit/../../../pc686/lib/include/rtems/score/object.h:29,
from ../../cpukit/../../../pc686/lib/include/rtems/rtems/types.h:49,
from ../../cpukit/../../../pc686/lib/include/rtems.h:42,
from ../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:20:

../../cpukit/../../../pc686/lib/include/rtems/score/chain.inl: In function '_Chain_Tail':
../../cpukit/../../../pc686/lib/include/rtems/score/chain.inl:107: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c: In function 'rtems_bsdnet_setup':
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:916: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:917: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:918: warning: dereferencing type-punned pointer might break strict-aliasing rules
make: * [rtems/libnetworking_a-rtems_glue.o] Error 1

This PR is only on the type-punned pointer warning in lines 916, 917, 918 (I am already looking into the Chain bugs), which contain casts between sockaddr and sockaddr_in.
Casting to (void*) instead of (sockaddr*) avoids these warnings, but I am not sure if these casts would be legitimate.

Change History (2)

comment:1 Changed on 12/08/06 at 16:32:32 by Ralf Corsepius

# <path>/configure --target=i386-rtems4.8
...
# make RTEMS_BSP=pc686 preinstall
...
# cd i386-rtems4.8/c/pc686/cpukit/libnetworking
...
# make CFLAGS="-mtune=pentiumpro -O2 -Werror -Wstrict-aliasing=2" \
rtems/libnetworking_a-rtems_glue.o
i386-rtems4.8-gcc --pipe -DHAVE_CONFIG_H -I.. -I../../cpukit/../../../pc686/lib/include -I../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -DBSD_VISIBLE -Wall -fasm -mtune=pentiumpro -O2 -Werror -Wstrict-aliasing=2 -MT rtems/libnetworking_a-rtems_glue.o -MD -MP -MF rtems/.deps/libnetworking_a-rtems_glue.Tpo -c -o rtems/libnetworking_a-rtems_glue.o test -f 'rtems/rtems_glue.c' || echo '../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/'rtems/rtems_glue.c
cc1: warnings being treated as errors
In file included from ../../cpukit/../../../pc686/lib/include/rtems/score/chain.h:173,

from ../../cpukit/../../../pc686/lib/include/rtems/score/object.h:29,
from ../../cpukit/../../../pc686/lib/include/rtems/rtems/types.h:49,
from ../../cpukit/../../../pc686/lib/include/rtems.h:42,
from ../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:20:

../../cpukit/../../../pc686/lib/include/rtems/score/chain.inl: In function '_Chain_Tail':
../../cpukit/../../../pc686/lib/include/rtems/score/chain.inl:107: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c: In function 'rtems_bsdnet_setup':
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:916: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:917: warning: dereferencing type-punned pointer might break strict-aliasing rules
../../../../../../../../rtems.orig/c/src/../../cpukit/libnetworking/rtems/rtems_glue.c:918: warning: dereferencing type-punned pointer might break strict-aliasing rules
make: * [rtems/libnetworking_a-rtems_glue.o] Error 1

This PR is only on the type-punned pointer warning in lines 916, 917, 918 (I am already looking into the Chain bugs), which contain casts between sockaddr and sockaddr_in.
Casting to (void*) instead of (sockaddr*) avoids these warnings, but I am not sure if these casts would be legitimate.

comment:2 Changed on 11/20/14 at 03:16:26 by Chris Johns

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.