EPICS Controls Argonne National Laboratory

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: EPICS 7.0.1-pre1 (pdbsingle.cpp)
From: Dirk Zimoch <[email protected]>
To: <[email protected]>
Date: Thu, 23 Nov 2017 14:41:27 +0100
I could build EPICS 7 for vxWorks 6.6, vxWorks 6.7 and ELDK 4.2 after this fix. I checked the resulting libraries and executables for any occurrence of (undefined) FieldName(const FieldName&) symbols. There are none. So it seems the compiler wants to have the definition but never actually uses it.

On 23.11.2017 14:21, Dirk Zimoch wrote:
This is my fix in pvif.h line 290:

#if defined(__GNUC__)&&__GNUC__*100+__GNUC_MINOR__<403
// workaround for gcc bug https://gcc.gnu.org/bugs/#cxx_rvalbind
public:
#else
private:
#endif
    FieldName(const FieldName&);
    FieldName& operator=(const FieldName&);


On 23.11.2017 13:56, Dirk Zimoch wrote:
https://gcc.gnu.org/bugs/#cxx_rvalbind


On 23.11.2017 12:03, Dirk Zimoch wrote:


On 23.11.2017 11:19, Dirk Zimoch wrote:
Clang 3.4.2 gives an interesting hint with its warnings. It seems that
this call creates a temporary, for which of course a copy is needed. If
you wanted to detect accidental copies, this is such a case.

I have analyzed the code a bit.

The message was:
"C++98 requires an accessible copy constructor for class 'FieldName'
when binding a reference to a temporary"

The line in question is:
pvif(channel->pv->builder->attach(channel->pv->chan, pvf, FieldName()))

This is the constructor call of pvif in the constructor of PDBSinglePut.
It is true, that a temporary is used here. FieldName() creates an object
that falls out of scope immediately after the attach() call.

The compiler cannot know what builder->attach() will do with with the
temporary. It has to expect the worst, which is to keep a reference to
the temporary FieldName object after the attach() call has returned.
Since this would then reference an invalid object.

So maybe the compiler rather implicitly creates a copy of which
builder->attach can keep a reference, like this:   attach(new
FieldName(FieldName()))

I need to check the C++ standard to see what the documented behavior is
in such a case.


References:
EPICS 7.0.1-pre1 Andrew Johnson
Re: EPICS 7.0.1-pre1 Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Michael Davidsaver
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch

Navigate by Date:
Prev: EPICS 7 makeBaseApp Timo Korhonen
Next: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) 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: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Next: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) 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 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·