Bug 45853

Summary: Segfault while experimenting with c++-0x initializer lists
Product: gcc Reporter: James Michael DuPont <JamesMikeDuPont>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 4.4.1   
Target Milestone: ---   
Host: Target:
Build: Known to work: 4.4.5, 4.5.2, 4.6.0
Known to fail: Last reconfirmed: 2011-05-16 11:00:14
Attachments: Compile Log
Preprocessed .ii file
This compiles

Description James Michael DuPont 2010-10-01 06:19:12 UTC
Created attachment 21928 [details]
Compile Log

I have been experimenting with c++ initializer lists and refactoring binutils to use c++. While doing so, the compiler crashed. I am reporting this in case it might help the development of the compiler.

Compiler is :
g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1

lsb version : 9.10 karmic with lots of backports and patches
Comment 1 James Michael DuPont 2010-10-01 06:22:22 UTC
Created attachment 21929 [details]
Preprocessed .ii file

This also crashes the compiler with the .ii file as well.

The line that causes the problem is :
 const struct dis386 bad_opcode = { "(bad)", { XX } };
Comment 2 James Michael DuPont 2010-10-01 06:31:43 UTC
Created attachment 21930 [details]
This compiles

If I remove the following line:
  dis386(const char *name,const std::initializer_list<T_ops> & a);

then the initializer compiles :

struct dis386 {
  const char *name;

  typedef struct t_ops
  {
    op_rtn rtn;
    int bytemode;
  } T_ops;
  
  T_ops op[MAX_OPERANDS];

  dis386(const char *name,std::initializer_list<T_ops> a);


};
Comment 3 Jonathan Wakely 2010-10-01 07:24:14 UTC
If you're testing features marked "experimental" then please use a current release or search existing bug reports, this doesn't seem to crash with 4.4.4 or later
Comment 4 Jonathan Wakely 2011-05-16 11:00:14 UTC
please try to reproduce this with a current FSF release or report it to Ubuntu

for C++0x bugs please try 4.5 or later, lots of initializer list bugs have been fixed already
Comment 5 James Michael DuPont 2011-05-16 19:17:06 UTC
Ok,
I will have to look into it,
thanks,
mike

On Mon, May 16, 2011 at 1:19 PM, redi at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45853
>
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|UNCONFIRMED                 |WAITING
>   Last reconfirmed|                            |2011.05.16 11:00:14
>     Ever Confirmed|0                           |1
>
> --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-16 11:00:14 UTC ---
> please try to reproduce this with a current FSF release or report it to Ubuntu
>
> for C++0x bugs please try 4.5 or later, lots of initializer list bugs have been
> fixed already
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 6 Jonathan Wakely 2011-05-17 11:33:03 UTC
No ICE on i686-pc-linux-gnu with:

gcc version 4.4.5 (Debian 4.4.5-8) 
gcc version 4.4.5 (GCC) 
gcc version 4.5.2 (GCC) 
gcc version 4.6.0 (GCC)
Comment 7 Paolo Carlini 2011-09-23 12:26:37 UTC
Let's close this.