Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wstrict-aliasing warnings #14

Open
sanjayankur31 opened this issue Nov 17, 2019 · 1 comment
Open

-Wstrict-aliasing warnings #14

sanjayankur31 opened this issue Nov 17, 2019 · 1 comment

Comments

@sanjayankur31
Copy link
Contributor

While building iv for NeuroFedora, we noticed a few -Wstrict-aliasing warnings (grepped from the build logs):

make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I../include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DCOLORIMETRY_SUPPORT -DJPEG_SUPPORT -DYCBCR_SUPPORT -DCMYK_SUPPORT -DHAVE_IEEEFP=1 -DUSE_VARARGS=0 -DUSE_PROTOTYPES=1 -DUSE_CONST=1 -I../include/TIFF -c TIFF/tif_dirwrite.c  -fPIC -DPIC -o TIFF/.libs/tif_dirwrite.o
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
TIFF/tif_dirwrite.c: In function 'TIFFWriteNormalTag':
TIFF/tif_dirwrite.c:442:24: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  442 |    dir->tdir_offset = *(u_long *)&fv; /* XXX */
      |                        ^~~~~~~~~~~~~
At top level:
TIFF/tif_dirwrite.c:5:13: warning: 'rcsid' defined but not used [-Wunused-variable]
--
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I../include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c Unidraw/catcmds.cpp  -fPIC -DPIC -o Unidraw/.libs/catcmds.o
Unidraw/catcmds.cpp: In member function 'virtual void ivViewCompCmd::Execute()':
Unidraw/catcmds.cpp:307:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  307 |         if (catalog->Retrieve(name, (Component*&) comp)) {
      |                                                   ^~~~
Unidraw/catcmds.cpp: In member function 'virtual void ivPrintCmd::Execute()':
Unidraw/catcmds.cpp:575:27: warning: 'tmpfilename' may be used uninitialized in this function [-Wmaybe-uninitialized]
--
Unidraw/import.cpp:220:10: warning: unused variable 'imported' [-Wunused-variable]
  220 |     bool imported = false;
      |          ^~~~~~~~
Unidraw/import.cpp: In static member function 'static ivGraphicComp* ivImportCmd::Import(const char*)':
Unidraw/import.cpp:260:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  260 |         if (catalog->Valid(filename, (Component*&) comp)) {
      |                                                    ^~~~
Unidraw/import.cpp:263:62: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  263 |         } else if (catalog->Retrieve(filename, (Component*&) comp)) {
      |                                                              ^~~~
Unidraw/import.cpp: In static member function 'static ivGraphicComp* ivImportCmd::PGM_Image(const char*)':
Unidraw/import.cpp:61:34: warning: value computed is not used [-Wunused-value]
--
make[3]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/bin/idraw'
make[3]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/bin/idraw'
g++ -DHAVE_CONFIG_H -I. -I. -Div2_6_compatible -I../../include/IV-2_6 -I../../include   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o ided.o ided.cpp
ided.cpp: In constructor 'IdrawEditor::IdrawEditor(const char*)':
ided.cpp:160:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  160 |  if (catalog->Retrieve(file, (Component*&) comp)) {
      |                                            ^~~~
make[3]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/bin/idraw'
make[3]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/bin/idraw'

Since these may result in undefined behaviour, they are worth looking into? (I looked at this post to understand the warning better---it has some suggestions on how to handle such issues too).

@sanjayankur31 sanjayankur31 changed the title -Wstrict-aliasing warning -Wstrict-aliasing warnings Nov 17, 2019
@sanjayankur31
Copy link
Contributor Author

build-log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant