EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: warnings about strict aliasing
From: Dirk Zimoch <[email protected]>
To: <[email protected]>
Date: Thu, 30 Nov 2017 15:53:54 +0100
On 30.11.2017 13:33, Dirk Zimoch wrote:
On 29.11.2017 20:51, Michael Davidsaver wrote:
On 11/29/2017 12:43 PM, Dirk Zimoch wrote:
The file anyscalar.h generates many warnings of the form

/afs/psi.ch/group/8431/dirk/git/BASE/epics-base-master/include/pv/anyscalar.h:98:
warning: dereferencing pointer ‘<anonymous>’ does break
strict-aliasing rules

The construct used (std::aligned_storage) is well defined in c++11.

http://en.cppreference.com/w/cpp/types/aligned_storage

I am a bit concerned about that because it may lead to wrong
optimization. I think this should either be fixed or
-fno-strict-aliasing should be added to the compiler flags for recent
gccs (i.e. not old vxWorks :-) )

GCC >=4.8.4 (at latest) doesn't warn about this even with -std=c++98.
So if anything, this is only need for older compilers.


I checked the code and found that older compilers (those who complain)
see a different piece of code. (#if __cplusplus>=201103L ... #else). And
not all of them complain.

I will do some tests to find out if I can remove the warnings. If not, I
will add the -fno-strict-aliasing compiler option to my architectures
which use older compilers and to the vxWorks configuration in EPICS.

But this is no showstopper for the release.


No warnings using std::aligned_storage
Yocto 2.1 (gcc 6.2.1)

No warnings using union blob_t
RHEL 7.3 (gcc 4.8.5)
RHEL 7.3 (clang 3.4.2)
SL6 (clang 3.4.2)
vxWorks 6.7 (gcc 4.1.2)
vxWorks 6.6 (gcc 4.1.2)
vxWorks 6.3 (gcc 3.4.4)
ELDK 4.2 (gcc  4.2.2)
ELDK 5.1 (gcc 4.6.1)
ELDK 5.2(gcc 4.6.4)
FSL 2.0 (gcc 4.9.2)

Warnings using union blob_t
SL6 (gcc 4.4.7)
moxa42-armv6l (gcc 4.4.2)

So the warnings seem to be limited to gcc 4.4.

For those architectures I have now set:
ARCH_DEP_CXXFLAGS += -fno-strict-aliasing


BTW: I have along weekend now. Back on Tuesday.

Dirk

References:
warnings about strict aliasing Dirk Zimoch
Re: warnings about strict aliasing Michael Davidsaver
Re: warnings about strict aliasing Dirk Zimoch

Navigate by Date:
Prev: Re: warnings about strict aliasing Dirk Zimoch
Next: Re: warnings about strict aliasing Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: warnings about strict aliasing Dirk Zimoch
Next: Re: warnings about strict aliasing Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024