Bug 1304098 - Compiler errors with GCC6 (building libreoffice)
Compiler errors with GCC6 (building libreoffice)
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
24
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-02 16:23 EST by coypu
Modified: 2016-02-27 03:48 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-27 03:48:20 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Preprocessed source (2.73 MB, text/x-csrc)
2016-02-02 16:23 EST, coypu
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 69649 None None None 2016-02-03 03:15 EST

  None (edit)
Description coypu 2016-02-02 16:23:58 EST
Created attachment 1120560 [details]
Preprocessed source

Exact reproduction steps:

Building LibreOffice from git.

I am using commit 773da02e8d2fc369c42eb2a799b41bf586acb4f5 of libreoffice.

There may be additional build problems (also related to libstdc++ problems) which prevent reaching this far:

1. Failure in firebirdsql (can be avoided with ./autogen.sh --disable-firebird-sdbc):
I've encountered the exact same error as here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57632

../src/common/classes/alloc.cpp: In function ‘void* operator new(size_t)’:
../src/common/classes/alloc.cpp:2107:7: error: declaration of ‘void* operator new(size_t) throw (std::bad_alloc)’ has a different exception specifier
 void* operator new(size_t s) THROW_BAD_ALLOC
       ^~~~~~~~

However I find it hard to believe that this bug is with the software, considering compilation worked without this flag previously, and upstream has not corrected this in any way (though they made some file changes).

2. Wrong abs ends up being used, but cannot correct by using using #include <cstdio> and specifying std::abs in sax/source/tools/converter.cxx as follows:

--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -35,6 +35,7 @@
 #include <osl/diagnose.h>
 
 #include <algorithm>
+#include <cstdio>
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -1267,7 +1268,7 @@ lcl_AppendTimezone(OUStringBuffer & i_rBuffer, sal_Int16 const nOffset)
             i_rBuffer.append('-');
         }
         const sal_Int32 nHours  (abs(nOffset) / 60);
-        const sal_Int32 nMinutes(abs(nOffset) % 60);
+        const sal_Int32 nMinutes(std::abs(nOffset) % 60);
         SAL_WARN_IF(nHours > 14 || (nHours == 14 && nMinutes > 0),
                 "sax", "convertDateTime: timezone overflow");
         if (nHours < 10)
@@ -1438,7 +1439,7 @@ static void lcl_ConvertToUTC(
         sal_Int16 const nSourceOffset)
 {
     sal_Int16 nOffsetHours(abs(nSourceOffset) / 60);
-    sal_Int16 const nOffsetMinutes(abs(nSourceOffset) % 60);
+    sal_Int16 const nOffsetMinutes(std::abs(nSourceOffset) % 60);
     o_rMinutes += nOffsetMinutes;
     if (nSourceOffset < 0)
     {


/home/fly/libreoffice/sax/source/tools/converter.cxx: In function ‘void sax::lcl_AppendTimezone(rtl::OUStringBuffer&, sal_Int16)’:
/home/fly/libreoffice/sax/source/tools/converter.cxx:1271:52: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
         const sal_Int32 nMinutes(std::abs(nOffset) % 60);
                                  ~~~~~~~~~~~~~~~~~~^~~~
/home/fly/libreoffice/sax/source/tools/converter.cxx: In function ‘void sax::lcl_ConvertToUTC(sal_Int16&, sal_uInt16&, sal_uInt16&, sal_uInt16&, sal_uInt16&, sal_Int16)’:
/home/fly/libreoffice/sax/source/tools/converter.cxx:1442:60: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
     sal_Int16 const nOffsetMinutes(std::abs(nSourceOffset) % 60);
                                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~

Discussed here: https://gerrit.libreoffice.org/#/c/22050/

I've had to correct it with type cast: abs((int) nOffset % 60) instead.

3. Finally, after all above failures and fixes to avoid them, internal compiler error:

[CXX] sc/source/filter/oox/biffinputstream.cxx
/home/fly/libreoffice/sc/source/filter/oox/autofiltercontext.cxx: In member function ‘virtual oox::core::ContextHandlerRef oox::xls::FilterSettingsContext::onCreateContext(sal_Int32, const oox::AttributeList&)’:
/home/fly/libreoffice/sc/source/filter/oox/autofiltercontext.cxx:36:19: internal compiler error: in assign_temp, at function.c:961
 ContextHandlerRef FilterSettingsContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
                   ^~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Source of biffinputstream.cxx used: http://cgit.freedesktop.org/libreoffice/core/tree/sc/source/filter/oox/biffinputstream.cxx?id=773da02e8d2fc369c42eb2a799b41bf586acb4f5
Comment 1 coypu 2016-02-02 16:26:53 EST
Woops, the source code is of the wrong file, but it is the right commit. Here's the right file: http://cgit.freedesktop.org/libreoffice/core/tree/sc/source/filter/oox/autofiltercontext.cxx?id=773da02e8d2fc369c42eb2a799b41bf586acb4f5
Comment 2 Jonathan Wakely 2016-02-02 17:01:44 EST
(In reply to coypu from comment #0)
> However I find it hard to believe that this bug is with the software,
> considering compilation worked without this flag previously, and upstream
> has not corrected this in any way (though they made some file changes).

GCC in rawhide now defaults to -std=gnu++14

> 2. Wrong abs ends up being used, but cannot correct by using using #include
> <cstdio> and specifying std::abs in sax/source/tools/converter.cxx as
> follows:

abs is overloaded in C++, so if you want abs(int) to be called not abs(double) then you need to call it with an argument of type int, not an argument of type double.
Comment 3 Jakub Jelinek 2016-02-02 17:33:20 EST
For the ICE, we need preprocessed source, not original source (use -save-temps, or -E instead of -c, or -freport-bug, but that should be the default), and full command line to reproduce it.
Comment 4 coypu 2016-02-02 19:03:10 EST
(In reply to Jakub Jelinek from comment #3)
> For the ICE, we need preprocessed source, not original source (use
> -save-temps, or -E instead of -c, or -freport-bug, but that should be the
> default), and full command line to reproduce it.

I've attached a file which I think is the preprocessed source, is it not the right thing?
Comment 5 coypu 2016-02-02 19:57:31 EST
(In reply to Jonathan Wakely from comment #2)
> (In reply to coypu from comment #0)
> > However I find it hard to believe that this bug is with the software,
> > considering compilation worked without this flag previously, and upstream
> > has not corrected this in any way (though they made some file changes).
> 
> GCC in rawhide now defaults to -std=gnu++14
> 
> > 2. Wrong abs ends up being used, but cannot correct by using using #include
> > <cstdio> and specifying std::abs in sax/source/tools/converter.cxx as
> > follows:
> 
> abs is overloaded in C++, so if you want abs(int) to be called not
> abs(double) then you need to call it with an argument of type int, not an
> argument of type double.

OK, that part is definitely not a bug. Sorry about that.
Thanks for the information regarding -std=gnu++14.
Comment 6 Jakub Jelinek 2016-02-03 03:15:30 EST
(In reply to coypu from comment #4)
> I've attached a file which I think is the preprocessed source, is it not the
> right thing?

Sorry, missed that.  Tracking the ICE upstream now: PR69649.
Comment 7 Jan Kurik 2016-02-24 10:33:44 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 8 Jakub Jelinek 2016-02-27 03:48:20 EST
This should be fixed in gcc-6.0.0-0.12.fc24.

Note You need to log in before you can comment on or make changes to this bug.