Segfaulting test-case with -flto

Stephan Bergmann sbergman at redhat.com
Thu Apr 19 12:56:45 UTC 2018


On 19/04/18 14:33, Martin Liška wrote:
> I'm GCC developer with high focus on LTO. We are trying to use the -flto in production.
> I can confirm that current trunk looks fine. But before that I added -flifetime-dse=1 to paper
> over the issue. Please -Wclass-memaccess new warnings that will come with GCC 8 that should
> find places where a memset is used to initialize a class fields.

Not sure how -Wclass-memaccess is relevant for LTO?  Anyway, had cleaned 
up LO master the other day to compile with upcoming GCC 8, committing 
various improvements (see `git log --grep=-Werror=class-memaccess`). 
Only a couple places seemed not so easy to fix (without introducing 
potential performance regressions), so they remained in the state of 
local TODO patches for now:

> diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
> index e21a11c9a088..f25b8e9b0a74 100644
> --- a/sc/inc/fillinfo.hxx
> +++ b/sc/inc/fillinfo.hxx
> @@ -177,6 +177,17 @@ struct RowInfo
>      RowInfo(const RowInfo&) = delete;
>      const RowInfo& operator=(const RowInfo&) = delete;
>  
> +    void clear() {
> +        pCellInfo = nullptr;
> +        nHeight = 0;
> +        nRowNo = 0;
> +        nRotMaxCol = 0;
> +        bEmptyBack = false;
> +        bAutoFilter = false;
> +        bPivotButton = false;
> +        bChanged = false;
> +    }
> +
>      CellInfo*           pCellInfo;
>  
>      sal_uInt16          nHeight;
> diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
> index b150231460a0..922cc07e75d3 100644
> --- a/sc/source/core/data/fillinfo.cxx
> +++ b/sc/source/core/data/fillinfo.cxx
> @@ -1088,7 +1088,9 @@ ScTableInfo::ScTableInfo(const SCSIZE capacity)
>      , mnArrCapacity(capacity)
>      , mbPageMode(false)
>  {
> -    memset(mpRowInfo.get(), 0, mnArrCapacity * sizeof(RowInfo));
> +    for (SCSIZE i = 0; i != mnArrCapacity; ++i) {
> +        mpRowInfo[i].clear();
> +    }
>  }
>  
>  ScTableInfo::~ScTableInfo()
> diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
> index 0395b9902528..6f19d293e2a1 100644
> --- a/sw/source/filter/ww8/ww8par2.cxx
> +++ b/sw/source/filter/ww8/ww8par2.cxx
> @@ -1572,7 +1572,7 @@ void WW8TabBandDesc::ReadNewShd(const sal_uInt8* pS, bool bVer67)
>  
>  void WW8TabBandDesc::setcelldefaults(WW8_TCell *pCells, short nCols)
>  {
> -    memset( pCells, 0, nCols * sizeof( WW8_TCell ) );
> +    memset( /*TODO*/static_cast<void *>(pCells), 0, nCols * sizeof( WW8_TCell ) );
>  }
>  
>  namespace


More information about the LibreOffice mailing list