[Bug c++/38712] New: [c++0x] ICE: Segmentation fault in auto function when decltype uses parameter pack expansion

View: New views
5 Messages — Rating Filter:   Alert me  

[Bug c++/38712] New: [c++0x] ICE: Segmentation fault in auto function when decltype uses parameter pack expansion

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could probably reduce this further:

template<class... T> struct Y {};

template<int... N> struct X {};

template<int N, class... T>
int g(Y<T...>) { return 0; }

template<class F, class... A, int... N>
auto foo(F f, Y<A...> t, X<N...>) -> decltype(f(g<N>(t)...))
{ return f(g<N>(t)...); }

void bar(int) { }

int main() {
  Y<int> y;
  foo(bar, y, X<0>()); //line 16
}

Compile with -std=c++0x gives:

seg.cpp:16: internal compiler error: Segmentation fault


--
           Summary: [c++0x] ICE: Segmentation fault in auto function when
                    decltype uses parameter pack expansion
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cfairles at gcc dot gnu dot org
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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


[Bug c++/38712] [c++0x] ICE: Segmentation fault in auto function when decltype uses parameter pack expansion

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-01-03 05:40 -------
*** Bug 38713 has been marked as a duplicate of this bug. ***


--


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


[Bug c++/38712] [c++0x] ICE: Segmentation fault in auto function when decltype uses parameter pack expansion

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-01-03 05:42 -------
While trying to mangle:
 <template_id_expr 0x436b9ab0
    type <lang_type 0x436b7bd0 unknown type type <lang_type 0x436b7bd0 unknown
type>
        VOID
        align 1 symtab 0 alias set -1 canonical type 0x436b7bd0
        pointer_to_this <lang_type 0x436b7bd0 unknown type> reference_to_this
<lang_type 0x436b7bd0 unknown type>>

    arg 0 <overload 0x436c83e0 type <lang_type 0x436b7bd0 unknown type>

        function <template_decl 0x436c7620 g type <function_type 0x436c74d0>
            VOID file t.cc line 6 col 14
            size <tree_list 0x436cc8c0
                purpose <tree_vec 0x436cc580
                    elt 0 <integer_cst 0x431f3d80 0>
                    elt 1 <type_argument_pack 0x436cacb0>> value <function_decl
0x436c0700 g>>
            align 1
            arguments <tree_list 0x436c81e0
                purpose <integer_cst 0x431f3450 constant 1>
                value <tree_vec 0x436c81c0 type <template_decl 0x436c7620 g>

                    elt 0 <tree_list 0x436c80c0>
                    elt 1 <tree_list 0x436c81a0>>> result <function_decl
0x436c0500 g>
            chain <template_decl 0x436c7070 X>>>
    arg 1 <tree_vec 0x436c89c0
        elt 0 <template_parm_index 0x436b9a20>>>



decltype (f((#'template_id_expr' not supported by
pp_c_expression#)(foo::t)...)) foo(F, Y<T ...>, X<N ...>) [with F = void
(*)(int), A = int, int ...N = 0] int g(Y<T ...>) [with int N = 0, T = int]

Hmm, I will let someone decide if this is an abi issue or not


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-03 05:42:55
               date|                            |


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


[Bug c++/38712] [c++0x] can't mangle template-id g<N>(t)

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from jason at gcc dot gnu dot org  2009-10-12 05:58 -------
This doesn't ICE anymore, it says

xxx.C:10:25: sorry, unimplemented: mangling template_id_expr

We need to update the ABI to support this.


--

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
           Keywords|ice-on-valid-code           |ABI, rejects-valid
   Last reconfirmed|2009-01-03 05:42:55         |2009-10-12 05:58:44
               date|                            |
            Summary|[c++0x] ICE: Segmentation   |[c++0x] can't mangle
                   |fault in auto function when |template-id g<N>(t)
                   |decltype uses parameter pack|
                   |expansion                   |


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


[Bug c++/38712] can't mangle template-id g<N>(t)

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #4 from jason at gcc dot gnu dot org  2009-11-12 04:59 -------
This issue isn't limited to C++0x mode:

struct A
{
  typedef int Type;
};

template <class T>
typename T::Type f ();

template <class T>
char (* g())[sizeof(f<T>())];

int main()
{
  g<A>();
}


--

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[c++0x] can't mangle        |can't mangle template-id
                   |template-id g<N>(t)         |g<N>(t)


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