Compile of KOffice with gcc4.1 failed.  Source condensed to a test case which
produces the following error:

---------------
test-case-1.cpp: In function ‘void prepare_inpaint()’:
test-case-1.cpp:55: error: incorrect sharing of tree nodes
D.1986_15 = "rb"[0];

"rb"[0];

test-case-1.cpp:55: internal compiler error: verify_stmts failed
---------------

gcc version info:

---------------
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure
Thread model: posix
gcc version 4.1.0 20050927 (experimental)
---------------

Compile command:

---------------
g++ -O2 -c test-case-1.cpp
---------------

The compile fails with O1, O2 and O3 but works with O0. Source code of test
case (note: I could not reduce it any further) :

---------------
namespace cimg_library
{       template<typename T = float> struct CImg;
        template<typename T = float> struct CImgl;

        struct Exception
        {
        };

        struct IOException : Exception
        {       IOException( const char * )
                {
                }
        };

        namespace cimg
        {       inline int* dummy( const char* const path, const char* const
mode )
                {       throw IOException( mode[ 0 ] == 'r' ? "a" : (mode[ 0 ]
== 'w' ? "b" : "" ));
                        return 0;
                }

        }

        template<typename T> struct CImg
        {       T *data;

                explicit CImg( const unsigned int dx = 0 )
                {
                }

                CImg( const char *filename )
                {       CImgl<T>( filename ).get_append( 'v', 'p' );
                }
        };

        template<typename T> struct CImgl
        {       CImgl( const unsigned int )
                {
                }

                CImgl(const char* filename)
                {       cimg::dummy( filename, "rb" );
                        unsigned int n;
                        CImgl<T> res( n );
                }

                CImg<T> get_append( const char, const char ) const
                {       CImg<T> res;
                        return res;
                }
        };
}

using namespace cimg_library;

void prepare_inpaint( )
{       cimg_library::CImg<unsigned char> mask = CImg<unsigned char>( "" );
}
---------------


-- 
           Summary: error: incorrect sharing of tree nodes
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kev dot gilbert at cdu dot edu dot au
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24172

Reply via email to