public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42447]  New: ICE during processing complex templates
@ 2009-12-21 12:38 piotr dot wyderski at gmail dot com
  2009-12-21 12:41 ` [Bug c++/42447] " piotr dot wyderski at gmail dot com
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 12:38 UTC (permalink / raw)
  To: gcc-bugs

Compile the attached sources as follows:

 g++ -std=gnu++0x -c -Wno-pmf-conversions file_reader.cpp

An Internal Compiler Error report will appear:

file_reader.cpp: In instantiation of
'std::unique_ptr<base::dynamic_dispatch<void
(io::file_reader::*)(io::request&)>::entry [], base::release_deleter>':
file_reader.cpp:35664:39:   instantiated from 'std::unique_ptr<_Tp [],
_Tp_Deleter>::unique_ptr() [with _Tp = base::dynamic_dispatch<void
(io::file_reader::*)(io::request&)>::entry, _Tp_Deleter =
base::release_deleter]'
file_reader.cpp:86579:76:   instantiated from 'base::dynamic_dispatch<TR
(TC::*)(TD&, TA ...)>::dynamic_dispatch(TR (TC::*)(TD&, TA ...), size_t) [with
TC = io::file_reader, TR = void, TD = io::request, TA = {}, TR (TC::*)(TD&, TA
...) = void (io::file_reader::*)(io::request&), size_t = unsigned int]'
file_reader.cpp:88954:55:   instantiated from here
file_reader.cpp:35653:5: internal compiler error: in finish_member_declaration,
at cp/semantics.c:2445
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE during processing complex templates
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: piotr dot wyderski at gmail dot com
  GCC host triplet: Cygwin/GCC-trunk


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
@ 2009-12-21 12:41 ` piotr dot wyderski at gmail dot com
  2009-12-21 13:00 ` paolo dot carlini at oracle dot com
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 12:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from piotr dot wyderski at gmail dot com  2009-12-21 12:41 -------
Created an attachment (id=19357)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19357&action=view)
The faulting code 


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
  2009-12-21 12:41 ` [Bug c++/42447] " piotr dot wyderski at gmail dot com
@ 2009-12-21 13:00 ` paolo dot carlini at oracle dot com
  2009-12-21 13:47 ` [Bug c++/42447] [C++0x] " piotr dot wyderski at gmail dot com
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 13:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-12-21 13:00 -------
Any chance you can provide a smaller reproducer? Thanks.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
  2009-12-21 12:41 ` [Bug c++/42447] " piotr dot wyderski at gmail dot com
  2009-12-21 13:00 ` paolo dot carlini at oracle dot com
@ 2009-12-21 13:47 ` piotr dot wyderski at gmail dot com
  2009-12-21 14:11 ` paolo dot carlini at oracle dot com
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from piotr dot wyderski at gmail dot com  2009-12-21 13:47 -------
(In reply to comment #2)
> Any chance you can provide a smaller reproducer? Thanks.
> 

No, every simpler testcase based on the attached code I tried
to create compiles successfully. Perhaps here is the problem?


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (2 preceding siblings ...)
  2009-12-21 13:47 ` [Bug c++/42447] [C++0x] " piotr dot wyderski at gmail dot com
@ 2009-12-21 14:11 ` paolo dot carlini at oracle dot com
  2009-12-21 14:28 ` piotr dot wyderski at gmail dot com
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 14:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2009-12-21 14:11 -------
Certainly *is* a problem if we hope to debug the issue decently fast...


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (3 preceding siblings ...)
  2009-12-21 14:11 ` paolo dot carlini at oracle dot com
@ 2009-12-21 14:28 ` piotr dot wyderski at gmail dot com
  2009-12-21 14:34 ` paolo dot carlini at oracle dot com
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from piotr dot wyderski at gmail dot com  2009-12-21 14:27 -------
(In reply to comment #4)
> Certainly *is* a problem if we hope to debug the issue decently fast...
> 

I meant "the cause of the problem is in its size", i.e.
there must be a critical mass of templates to trigger
the issue. There probably is no problem in std::unique_ptr
on its own; to me it seems to be a "random victim" of
something strange happening under the hood. As I said,
I am not able to shrink it down in a reasonable way.
For example, this simplified testcase compiles flawlessly:


#include <memory>

    struct release_deleter {

        template <class T> void operator()(T* p) {

            static_assert(std::is_pod<T>::value ||
                          std::is_same<T, void>::value,
                          "T must be a POD type or void");

        }
    };


    template <typename T> class dynamic_dispatch;


    template <

        typename TC,
        typename TR,
        typename TD,
        typename... TA

    > class dynamic_dispatch<TR (TC::*)(TD&, TA...)> {

        class entry {};

        typedef std::unique_ptr<entry[], release_deleter> entry_ptr;

    public:

        template <typename UC, typename UD> void attach_handler(TR
(UC::*m)(UD&, TA...));
    };



    template <

        typename TC,
        typename TR,
        typename TD,
        typename... TA

    > template <

        typename UC,
        typename UD

    > void dynamic_dispatch<TR (TC::*)(TD&, TA...)>::attach_handler(TR
(UC::*m)(UD&, TA...)) {

    };


    class C {

    public:

        void M(int&);
    };


dynamic_dispatch<void (C::*)(int&)> dd;

int main() {

    dd.attach_handler(&C::M);
}

But the problem is definitely related to template
processing. If you comment out the folowing line
(at the very bottom of the attached file, in the
constructor):

attach_handler(static_cast<void (file_reader::*)(read_request<0>&)>
(&file_reader::execute_command)); 

it compiles OK.


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (4 preceding siblings ...)
  2009-12-21 14:28 ` piotr dot wyderski at gmail dot com
@ 2009-12-21 14:34 ` paolo dot carlini at oracle dot com
  2009-12-21 16:09 ` pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 14:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from paolo dot carlini at oracle dot com  2009-12-21 14:34 -------
Ok... Did you help yourself with delta? See:

  http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (5 preceding siblings ...)
  2009-12-21 14:34 ` paolo dot carlini at oracle dot com
@ 2009-12-21 16:09 ` pinskia at gcc dot gnu dot org
  2009-12-21 16:14 ` paolo dot carlini at oracle dot com
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-21 16:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (6 preceding siblings ...)
  2009-12-21 16:09 ` pinskia at gcc dot gnu dot org
@ 2009-12-21 16:14 ` paolo dot carlini at oracle dot com
  2009-12-21 16:38 ` piotr dot wyderski at gmail dot com
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 16:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo dot carlini at oracle dot com  2009-12-21 16:14 -------
I'm reducing it.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-21 16:14:43
               date|                            |


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (7 preceding siblings ...)
  2009-12-21 16:14 ` paolo dot carlini at oracle dot com
@ 2009-12-21 16:38 ` piotr dot wyderski at gmail dot com
  2009-12-21 16:49 ` paolo dot carlini at oracle dot com
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 16:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from piotr dot wyderski at gmail dot com  2009-12-21 16:38 -------
(In reply to comment #6)

A marvelous tool! I'm reducing it too,
staring at the proces with half-open mouth...


-- 

piotr dot wyderski at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (8 preceding siblings ...)
  2009-12-21 16:38 ` piotr dot wyderski at gmail dot com
@ 2009-12-21 16:49 ` paolo dot carlini at oracle dot com
  2009-12-21 17:18 ` paolo dot carlini at oracle dot com
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 16:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (9 preceding siblings ...)
  2009-12-21 16:49 ` paolo dot carlini at oracle dot com
@ 2009-12-21 17:18 ` paolo dot carlini at oracle dot com
  2009-12-21 17:24 ` piotr dot wyderski at gmail dot com
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 17:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from paolo dot carlini at oracle dot com  2009-12-21 17:18 -------
Note that a compiler built --disable-checking doesn't ICE, just errors out.
Thus, are you sure the code is valid, before anything else?


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (10 preceding siblings ...)
  2009-12-21 17:18 ` paolo dot carlini at oracle dot com
@ 2009-12-21 17:24 ` piotr dot wyderski at gmail dot com
  2009-12-21 17:31 ` paolo dot carlini at oracle dot com
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from piotr dot wyderski at gmail dot com  2009-12-21 17:23 -------
(In reply to comment #9)
> Thus, are you sure the code is valid, before anything else?

It compiles and works on gcc version 4.5.0 20090604.

The current compiler is 

Configured with: ../configure --prefix=/opt/gcc-trunk -v --enable-bootstrap
--en
able-version-specific-runtime-libs --enable-shared --enable-shared-libgcc
--with
-gnu-ld --with-gnu-as --enable-dwarf2-exceptions --disable-symvers
--disable-nls
 --with-arch=core2 --with-tune=generic --enable-threads=posix
--enable-languages
=c,c++
Thread model: posix
gcc version 4.5.0 20091217 (experimental) (GCC)

And here's the reduced testcase:

------------------8<------------------

namespace std
  template<typename _Tp>
    struct __add_ref<_Tp&>
    { typedef _Tp& type; };
    class tuple<>
    {
    };
  template<typename _T1, typename _T2>
    {
      {
      }
    };
  template<std::size_t __i, typename... _Elements>
    inline typename __add_ref<
                    >::type
    get(tuple<_Elements...>& __t)
    {
    }
}
    struct _Fnv_hash<4>
    {
      {
      }
    };
namespace std {
  template <class _OutputIterator, class _Tp>
    {
  {
    {
    }
    {
 {
      }
    }
  };
}
  template <typename _Tp, typename _Tp_Deleter = default_delete<_Tp> >
    class unique_ptr
    {
      reset(pointer __p = pointer())
      {
   {
   }
      }
      {
      }
  };
  template<typename _Tp, typename _Tp_Deleter>
    class unique_ptr<_Tp[], _Tp_Deleter>
    {
      typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
      get() const
      { return std::get<0>(_M_t); }
      __tuple_type _M_t;
  };
namespace base {
    struct release_deleter {
        template <class T> void operator()(T* p) {
        }
    };
    template <typename T> class dynamic_dispatch;
    template <
        typename TC,
        typename TR,
        typename TD,
        typename... TA
    > class dynamic_dispatch<TR (TC::*)(TD&, TA...)> {
        struct entry {
        };
        typedef std::unique_ptr<entry[], release_deleter> entry_ptr;
        entry_ptr m_Start;
        template <typename UC, typename UD> void attach_handler(TR
(UC::*m)(UD&, TA...));
    };
    template <
        typename TC,
        typename TR,
        typename TD,
        typename... TA
    > template <
        typename UC,
        typename UD
    > void dynamic_dispatch<TR (TC::*)(TD&, TA...)>::attach_handler(TR
(UC::*m)(UD&, TA...)) {
        entry* p = m_Cursor;
        if (p != m_Start.get()) {
            } while(--p != m_Start.get());
        }
    class __attribute__((dllexport)) request {
    };
    template <std::size_t N_CHID> class read_request : public read_request_base
{
    };
    template <typename TC> class request_dispatcher
      : private base::dynamic_dispatch<void (TC::*)(request&)> {
        request_dispatcher();
    };
    class __attribute__((dllexport)) device {
        struct __attribute__((dllexport)) control_block : public OVERLAPPED {
            explicit control_block(request& req) {
            }
        };
    };
    class __attribute__((dllexport)) file_reader : public physical_device {
        void execute_command(read_request<0>& req);
    };
    template <> request_dispatcher<file_reader>::request_dispatcher()
      : super(&file_reader::report_unsupported_request) {
        attach_handler(&file_reader::execute_command); 


-- 

piotr dot wyderski at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (11 preceding siblings ...)
  2009-12-21 17:24 ` piotr dot wyderski at gmail dot com
@ 2009-12-21 17:31 ` paolo dot carlini at oracle dot com
  2009-12-21 17:39 ` piotr dot wyderski at gmail dot com
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 17:31 UTC (permalink / raw)
  To: gcc-bugs



-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [C++0x] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (12 preceding siblings ...)
  2009-12-21 17:31 ` paolo dot carlini at oracle dot com
@ 2009-12-21 17:39 ` piotr dot wyderski at gmail dot com
  2009-12-21 18:33 ` [Bug c++/42447] [4.5 Regresson] " paolo dot carlini at oracle dot com
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2009-12-21 17:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from piotr dot wyderski at gmail dot com  2009-12-21 17:38 -------
An even more reduced testcase which ICEs. Delta is amazing...
I think I'll stop here.

// ------------------------8<----------------

namespace std
    class tuple<>
    {
    };
  template<std::size_t __i, typename... _Elements>
    get(tuple<_Elements...>& __t)
    {
    }
  template <class _OutputIterator, class _Tp>
    class unique_ptr
    {
  };
  template<typename _Tp, typename _Tp_Deleter>
    class unique_ptr<_Tp[], _Tp_Deleter>
    {
      typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
      get() const
      { return std::get<0>(_M_t); }
      __tuple_type _M_t;
  };
namespace base {
    struct release_deleter {
    };
    template <typename T> class dynamic_dispatch;
    template <
        typename TC,
        typename TR,
        typename TD,
        typename... TA
    > class dynamic_dispatch<TR (TC::*)(TD&, TA...)> {
        struct entry {
        };
        typedef std::unique_ptr<entry[], release_deleter> entry_ptr;
        entry_ptr m_Start;
        template <typename UC, typename UD> void attach_handler(TR
(UC::*m)(UD&, TA...));
    };
    template <
        typename TC,
        typename TR,
        typename TD,
        typename... TA
    > template <
        typename UC,
        typename UD
    > void dynamic_dispatch<TR (TC::*)(TD&, TA...)>::attach_handler(TR
(UC::*m)(UD&, TA...)) {
        entry* p = m_Cursor;
        if (p != m_Start.get()) {
            } while(--p != m_Start.get());
        }
    class __attribute__((dllexport)) request {
    };
    template <std::size_t N_CHID> class read_request : public read_request_base
{
    };
    template <typename TC> class request_dispatcher
      : private base::dynamic_dispatch<void (TC::*)(request&)> {
        request_dispatcher();
    };
    class __attribute__((dllexport)) file_reader : public physical_device {
        void execute_command(read_request<0>& req);
    };
    template <> request_dispatcher<file_reader>::request_dispatcher()
      : super(&file_reader::report_unsupported_request) {
        attach_handler(&file_reader::execute_command); 


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regresson] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (13 preceding siblings ...)
  2009-12-21 17:39 ` piotr dot wyderski at gmail dot com
@ 2009-12-21 18:33 ` paolo dot carlini at oracle dot com
  2009-12-21 20:29 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 18:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from paolo dot carlini at oracle dot com  2009-12-21 18:33 -------
Ok, thanks. From your work I produced the below, which doesn't use any C++0x
feature and to me looks like a 4.5 Regression.

///////////////////

template<typename _Tp, typename _Up>
  struct tuple { };

template<int __i, typename _Tp, typename _Up>
  void*
  get(const tuple<_Tp, _Up>&);

template <typename _Tp, typename _Tp_Deleter = void>
  struct unique_ptr;

template<typename _Tp, typename _Tp_Deleter>
  struct unique_ptr<_Tp[], _Tp_Deleter>
  {
    typedef tuple<_Tp*, _Tp_Deleter> __tuple_type;

    void*
    get() const
    { return ::get<0>(_M_t); }

    __tuple_type _M_t;
  };

struct release_deleter;

template <typename T> class dynamic_dispatch;

template <typename TC, typename TR, typename TD>
  struct dynamic_dispatch<TR (TC::*)(TD&)>
  {
    struct entry { };

    typedef unique_ptr<entry[], release_deleter> entry_ptr;
    entry_ptr m_Start;

    template <typename UC, typename UD>
      void attach_handler(TR (UC::*m)(UD&))
      {
        entry* p = 0;
        if (p != m_Start.get()) {
        } while(--p != m_Start.get());
      }
  };

struct request;

struct read_request;

template <typename TC>
  class request_dispatcher
  : private dynamic_dispatch<void (TC::*)(request&)>
  { request_dispatcher(); };

struct file_reader
{
  void execute_command(read_request&);
};

template <>
  request_dispatcher<file_reader>::request_dispatcher()
{
  attach_handler(&file_reader::execute_command); 
}


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|piotr dot wyderski at gmail |jason at gcc dot gnu dot org
                   |dot com                     |
      Known to fail|                            |4.5.0
      Known to work|                            |4.4.1
           Priority|P3                          |P1
            Summary|[C++0x] ICE during          |[4.5 Regresson] ICE during
                   |processing complex templates|processing complex templates
   Target Milestone|---                         |4.5.0


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regresson] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (14 preceding siblings ...)
  2009-12-21 18:33 ` [Bug c++/42447] [4.5 Regresson] " paolo dot carlini at oracle dot com
@ 2009-12-21 20:29 ` paolo dot carlini at oracle dot com
  2009-12-21 20:54 ` hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-21 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from paolo dot carlini at oracle dot com  2009-12-21 20:29 -------
A tad simpler:

template<int>
  void* get(int);

template<typename>
  struct unique_ptr;

template<typename _Tp>
  struct unique_ptr<_Tp[]>
  {
    typedef int __tuple_type;

    void*
    get() const
    { return ::get<0>(_M_t); }

    __tuple_type _M_t;
  };

template <typename T> class dynamic_dispatch;

template <typename TC>
  struct dynamic_dispatch<void (TC::*)(int&)>
  {
    struct entry { };
    unique_ptr<entry[]> m_Start;

    template <typename UC>
      void attach_handler(void (UC::*m)(int&))
      {
        entry* p = 0;
        do {
        } while(--p != m_Start.get());
      }
  };

template <typename TC>
  class request_dispatcher
  : private dynamic_dispatch<void (TC::*)(int&)>
  { request_dispatcher(); };

struct file_reader
{
  void execute_command(int&);
};

template <>
  request_dispatcher<file_reader>::request_dispatcher()
  { this->attach_handler(&file_reader::execute_command); }


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regresson] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (15 preceding siblings ...)
  2009-12-21 20:29 ` paolo dot carlini at oracle dot com
@ 2009-12-21 20:54 ` hjl dot tools at gmail dot com
  2009-12-28 19:53 ` [Bug c++/42447] [4.5 Regression] " jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-12-21 20:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from hjl dot tools at gmail dot com  2009-12-21 20:54 -------
It is caused by revision 151461:

http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00207.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regression] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (16 preceding siblings ...)
  2009-12-21 20:54 ` hjl dot tools at gmail dot com
@ 2009-12-28 19:53 ` jason at gcc dot gnu dot org
  2009-12-29  3:33 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-28 19:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-12-21 16:14:43         |2009-12-28 19:53:43
               date|                            |


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regression] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (17 preceding siblings ...)
  2009-12-28 19:53 ` [Bug c++/42447] [4.5 Regression] " jason at gcc dot gnu dot org
@ 2009-12-29  3:33 ` jason at gcc dot gnu dot org
  2009-12-30 19:36 ` jason at gcc dot gnu dot org
  2010-01-07 22:24 ` hjl at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-29  3:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jason at gcc dot gnu dot org  2009-12-29 03:33 -------
Subject: Bug 42447

Author: jason
Date: Tue Dec 29 03:33:24 2009
New Revision: 155499

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155499
Log:
        PR c++/42447
        * pt.c (iterative_hash_template_arg): Don't rely on TYPE_CANONICAL
        for ARRAY_TYPE.

Added:
    trunk/gcc/testsuite/g++.dg/template/array21.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regression] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (18 preceding siblings ...)
  2009-12-29  3:33 ` jason at gcc dot gnu dot org
@ 2009-12-30 19:36 ` jason at gcc dot gnu dot org
  2010-01-07 22:24 ` hjl at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-30 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jason at gcc dot gnu dot org  2009-12-30 19:36 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/42447] [4.5 Regression] ICE during processing complex templates
  2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
                   ` (19 preceding siblings ...)
  2009-12-30 19:36 ` jason at gcc dot gnu dot org
@ 2010-01-07 22:24 ` hjl at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-01-07 22:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from hjl at gcc dot gnu dot org  2010-01-07 22:23 -------
Subject: Bug 42447

Author: hjl
Date: Thu Jan  7 22:22:32 2010
New Revision: 155713

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155713
Log:
Backport tests from mainline

2010-01-07  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2010-01-06  Richard Guenther  <rguenther@suse.de>

        * gcc.c-torture/compile/pr42632.c: New testcase.

        2010-01-05  Martin Jambor  <mjambor@suse.cz>

        PR tree-optimization/42462
        * g++.dg/torture/pr42462.C: New test.

        2010-01-05  Jakub Jelinek  <jakub@redhat.com>

        PR tree-optimization/42508
        * g++.dg/opt/pr42508.C: New test.

        2010-01-04  Martin Jambor  <mjambor@suse.cz>

        PR tree-optimization/42398
        * gcc.c-torture/compile/pr42398.c: New test.

        2010-01-04  Jason Merrill  <jason@redhat.com>

        PR c++/42555
        * g++.dg/ext/attrib35.C: New.

        2010-01-01  Richard Guenther  <rguenther@suse.de>

        PR c/42570
        * gcc.c-torture/execute/pr42570.c: New testcase.

        2010-01-01  Richard Guenther  <rguenther@suse.de>

        PR middle-end/42559
        * gcc.c-torture/compile/pr42559.c: New testcase.

        2009-12-30  Joseph Myers  <joseph@codesourcery.com>

        PR c/42439
        * gcc.dg/bitfld-19.c: New test.

        2009-12-28  Jason Merrill  <jason@redhat.com>

        PR c++/42447
        * g++.dg/template/array21.C: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib35.C
      - copied unchanged from r155711,
trunk/gcc/testsuite/g++.dg/ext/attrib35.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/pr42508.C
      - copied unchanged from r155711, trunk/gcc/testsuite/g++.dg/opt/pr42508.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/array21.C
      - copied unchanged from r155710,
trunk/gcc/testsuite/g++.dg/template/array21.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42462.C
      - copied unchanged from r155711,
trunk/gcc/testsuite/g++.dg/torture/pr42462.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42398.c
      - copied unchanged from r155711,
trunk/gcc/testsuite/gcc.c-torture/compile/pr42398.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42559.c
      - copied unchanged from r155712,
trunk/gcc/testsuite/gcc.c-torture/compile/pr42559.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42632.c
      - copied unchanged from r155710,
trunk/gcc/testsuite/gcc.c-torture/compile/pr42632.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42570.c
      - copied unchanged from r155712,
trunk/gcc/testsuite/gcc.c-torture/execute/pr42570.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/bitfld-19.c
      - copied unchanged from r155710, trunk/gcc/testsuite/gcc.dg/bitfld-19.c
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-01-07 22:24 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-21 12:38 [Bug c++/42447] New: ICE during processing complex templates piotr dot wyderski at gmail dot com
2009-12-21 12:41 ` [Bug c++/42447] " piotr dot wyderski at gmail dot com
2009-12-21 13:00 ` paolo dot carlini at oracle dot com
2009-12-21 13:47 ` [Bug c++/42447] [C++0x] " piotr dot wyderski at gmail dot com
2009-12-21 14:11 ` paolo dot carlini at oracle dot com
2009-12-21 14:28 ` piotr dot wyderski at gmail dot com
2009-12-21 14:34 ` paolo dot carlini at oracle dot com
2009-12-21 16:09 ` pinskia at gcc dot gnu dot org
2009-12-21 16:14 ` paolo dot carlini at oracle dot com
2009-12-21 16:38 ` piotr dot wyderski at gmail dot com
2009-12-21 16:49 ` paolo dot carlini at oracle dot com
2009-12-21 17:18 ` paolo dot carlini at oracle dot com
2009-12-21 17:24 ` piotr dot wyderski at gmail dot com
2009-12-21 17:31 ` paolo dot carlini at oracle dot com
2009-12-21 17:39 ` piotr dot wyderski at gmail dot com
2009-12-21 18:33 ` [Bug c++/42447] [4.5 Regresson] " paolo dot carlini at oracle dot com
2009-12-21 20:29 ` paolo dot carlini at oracle dot com
2009-12-21 20:54 ` hjl dot tools at gmail dot com
2009-12-28 19:53 ` [Bug c++/42447] [4.5 Regression] " jason at gcc dot gnu dot org
2009-12-29  3:33 ` jason at gcc dot gnu dot org
2009-12-30 19:36 ` jason at gcc dot gnu dot org
2010-01-07 22:24 ` hjl at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).