https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99086

            Bug ID: 99086
           Summary: including <iterator> and defaulting spaceship operator
                    causes compiler segfault
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crillion at tiscali dot it
  Target Milestone: ---

Created attachment 50178
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50178&action=edit
an archive containing .ii and .s files for windows and linux

Hi,

  a little program with a tiny class defaulting the spaceship operator and the
inclusion of <iterator> header causes compiler segfault (the compiler gives
segmentation error while compiling, no executable is produced).

I could see this behaviour on these systems :

(windows 10 64bit)
(it's the g++ 10.2 from mingw-w64 distribution obtained by msys2)
g++ --version
g++ (Rev6, Built by MSYS2 project) 10.2.0

(linux opensuse 15.2 64bit, hosted on virtual box 6.1.16 r140961 (Qt5.6.2),
running on my above windows system)
> g++ --version
g++ (SUSE Linux) 10.2.1 20200825 [revision
c0746a1beb1ba073c7981eb09f55b3d993b32e5c]

==============
program.cpp :
------------------


#include <iterator>

class value_wrapper
{
        public :

                bool operator<=>(const value_wrapper& rhs) const = default;

        private :

                unsigned short value_;
};

int main(int, char**)
{
        value_wrapper lhs, rhs;

        auto x = lhs < rhs;
}

=================================
batch file used to compile it (already including your recommended switches in
bug reporting instructions, which turn out not to mitigate the segfault error)

windows :

g++ -std=c++20 -pedantic -Wall -Wextra -Werror=return-type -Wshadow=local
-Wempty-body -fdiagnostics-color -s -Os -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations program.cpp -save-temps -o program_gpp.exe

linux :
g++ -std=c++20 -pedantic -Wall -Wextra -Werror=return-type -Wshadow=local
-Wempty-body -fdiagnostics-color -s -Os -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations program.cpp -save-temps -o program_gpp


I add as attachment a 7zip archive containing the requested .ii and .s files
respectively for the windows and linux compilation:

program.ii.linux
program.ii.windows
program.s.linux
program.s.windows

I was originally using a field of type boost gregorian date, which in turn
causes inclusion of <iterator>. I could reduce boost include files just to the
inclusion of <iterator>
Sorry but I didn't reduce, nor inspect the <iterator> header, since I consider
standard library headers too complicated for me to analyze.

Thanks,
           Marco

Reply via email to