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  2017  2018  2019  2020  <20212022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: [Bug 1905159] Re: Fix warnings from recent compiler versions
From: Gabriel Fedel via Core-talk <core-talk at aps.anl.gov>
To: core-talk at aps.anl.gov
Date: Wed, 10 Mar 2021 10:28:11 -0000
There are some warnings from gcc 8.3.0 (and above) on biRecord.c and on
boRecord.c similar to this one (from 3.15 branch):

../../../src/std/rec/biRecord.c: In function ‘get_enum_str’:                                                                                                                                               
../../../src/std/rec/biRecord.c:165:35: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  strncpy(pstring,prec->znam,sizeof(prec->znam));                                                                                                                                                          

---

I think it looks a place where a problem could occur if the size of znam is greater than pstring. If we are sure this is not an issue, we could solve the warning using a fixed length (on the biRecord and boRecord case, znam and onam have length 26).
On that case, could make sense to have a constant for onam, znam (and others similar) length.

Does it make sense? 
Any other suggestion ?

-- 
You received this bug notification because you are a member of EPICS
Core Developers, which is subscribed to EPICS Base.
Matching subscriptions: epics-core-list-subscription
https://bugs.launchpad.net/bugs/1905159

Title:
  Fix warnings from recent compiler versions

Status in EPICS Base:
  Triaged

Bug description:
  Builds of EPICS Base using recent versions of gcc, clang and MSVC
  generate compiler warnings, which we try to minimize if possible. Some
  of these warnings can be prevented with suitable code modifications,
  although the code must still build on the older compilers and other
  architectures that we support.

  Both the 3.15 and 7.0 branches can be examined for warnings; fixes
  made on the 3.15 branch get propagated to the 7.0 branch during
  periodic up-merges, so there is no need to make the same changes to
  both branches. Some code only exists on one branch; for example the
  gdd module was unbundled after 3.15, and there are many new modules in
  7.0.

To manage notifications about this bug go to:
https://bugs.launchpad.net/epics-base/+bug/1905159/+subscriptions

Navigate by Date:
Prev: Re: [Merge] ~dirk.zimoch/epics-base:FilterForInfoFields into epics-base:7.0 Dirk Zimoch via Core-talk
Next: Re: [Merge] ~dirk.zimoch/epics-base:FilterForInfoFields into epics-base:7.0 Ben Franksen via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: [Bug 1905159] Re: Fix warnings from recent compiler versions Andrew Johnson via Core-talk
Next: [Bug 1905159] Re: Fix warnings from recent compiler versions Gabriel Fedel via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 10 Mar 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·