g++ crashes over an array initialization in a long line of a cpp file

Bug #785587 reported by Koray Kalmaz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.5 (Ubuntu)
Triaged
Low
Unassigned
gcc-4.6 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.5

While playing around, I noticed that command: "$ g++ -Wall -o getart getart.cpp" repeatedly crashes with the following output:

getart.cpp: In constructor ‘drawing::drawing()’:
getart.cpp:30:151: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
getart.cpp:30:151: error: too many initializers for ‘std::string [15]’
getart.cpp:30: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccW4E0uv.out file, please attach this to your bugreport.

*Please note the code below is not finished and not supposed to work

FILE getart.cpp:

#include <iostream>
#include <vector>
# include "getart.h"
using namespace std;

char capa[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0x0, 0xF, 0xD, 0x0, 0x6, 0xA, 0xC, 0xC};
char capb[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0x9, 0x3, 0x5, 0x0, 0x6, 0xA, 0xC, 0xC};
char capc[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0xF, 0xF, 0x5, 0x0, 0x6, 0xC, 0x6, 0xC};

drawing::drawing(){
    connections={" ", " ", " ", "\u2554", " ", "\u2550", "\u2557", "\u2566", " ", "\u255A", "\u2551", "\u2560", "\u255D", "\u2569", "\u2563", "\u256C"};
}
int main(int argc, char *argv[]){
    // cout << "There are " << argc << " arguments:" << endl;
    // for (int nArg=0; nArg < argc; nArg++) {
        // cout << nArg << " " << argv[nArg] << endl;
    // }

    // for (int i=0;i<15;i++){
        // cout << "Pos " << i << ": " << int(capa[i]) << endl;
    // }
    string hede = argv[1];
    if (argc >1){
        for (unsigned int k=0;k<hede.size();k++){
            cout << hede[k] << endl;
        }
    }
    cout << "\u256C" << endl;
}

FILE getart.h:

# ifndef GETART_H
# define GETART_H
using namespace std;

class artLetter{
    public:
        artLetter(char L);
};

class drawing{
    public:
        drawing();
        string connections[15];
};

# endif

ProblemType: Crash
DistroRelease: Ubuntu 11.04
Package: g++-4.5 4.5.2-8ubuntu4
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic i686
Architecture: i386
Date: Fri May 20 17:06:59 2011
EcryptfsInUse: Yes
ExecutablePath: /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus
InstallationMedia: Ubuntu-Netbook 10.10 "Maverick Meerkat" - Release i386 (20101007)
SourcePackage: gcc-4.5
UpgradeStatus: Upgraded to natty on 2011-05-06 (13 days ago)

Revision history for this message
Koray Kalmaz (vanwarantion) wrote :
summary: - g++ crashes over a array initialization in a long cpp file
+ g++ crashes over an array initialization in a long cpp file
summary: - g++ crashes over an array initialization in a long cpp file
+ g++ crashes over an array initialization in a long line of a cpp file
Revision history for this message
Matthias Klose (doko) wrote :

confirmed, ICE on invalid code during error recovery. fixed in GCC 4.6

Changed in gcc-4.6 (Ubuntu):
status: New → Fix Released
Changed in gcc-4.5 (Ubuntu):
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.