[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#294560: ICE on array initialization



Package: g++-3.3
Version: 1:3.3.5-8
Severity: normal

This works correctly in both 3.2 and 3.4. The behaviour seems to
correspond with bug #276291 but since that does not include a source
snippet I can not compare it.

g++ 3.3 gives me:

> g++     test.cc   -o test
> test.cc: In member function `Kevent::action_type Kevent::DecodeAction(const char*, int)':
> test.cc:38: internal compiler error: in tree_low_cst, at tree.c:3255

g++ 3.4 produces:

test.cc: In member function `Kevent::action_type Kevent::DecodeAction(const char*, int)':
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: initializer-string for array of chars is too long
test.cc:24: error: excess elements in aggregate initializer

Full source for the testcase is below.

Wichert.

#include <map>
#include <string>

class Kevent {
public:
	enum action_type { add,remove,change,mount,umount,offline,online };
	action_type DecodeAction(const char* action, int len);
};


Kevent::action_type Kevent::DecodeAction(const char* action, int len) {
	struct {
		const char action[];
		action_type type;
	} actions[] = {
		{ "add",	add	},
		{ "remove",	remove	},
		{ "change",	change	},
		{ "mount",	mount	},
		{ "umount",	umount	},
		{ "offline",	offline	},
		{ "online",	online	},
		{ NULL, 0 },
	};
}

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-ac12
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages g++-3.3 depends on:
ii  gcc-3.3                     1:3.3.5-8    The GNU C compiler
ii  gcc-3.3-base                1:3.3.5-8    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libstdc++5-3.3-dev          1:3.3.5-8    The GNU Standard C++ Library v3 (d

-- no debconf information



Reply to: