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

Bug#358755: marked as done (g++-4.0: G++ drops const int arrays)



Your message dated Fri, 24 Mar 2006 12:13:18 +0100
with message-id <87r74syu29.fsf@debian.org>
and subject line Bug#358755: g++-4.0: G++ drops const int arrays
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: g++-4.0
Version: 4.0.3-1
Severity: normal

Hi,

G++ seems to drop const int arrays, while gcc compiles them correctly.

See the following example of the two attached files:

gcc -Wall -c gen_array.c
gcc -Wall -o gen_array gen_array.o
./gen_array > array.cc
g++ -Wall -o array.cc.o -c array.cc
ls -l array.cc.o
-rw-r--r--  1 schabi schabi 638 Mar 24 11:19 array.cc.o
./gen_array > array.c
gcc -Wall -o array.c.o -c array.c
ls -l array.c.o
-rw-r--r--  1 schabi schabi 4735 Mar 24 11:19 array.c.o


array_cc.o should also be more than 4000 bytes large, because the array
contents itsself are 4000 bytes. GCC seems to translate it correctly.

Thanks,
Markus
-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-fire
Locale: LANG=C, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)

Versions of packages g++-4.0 depends on:
ii  gcc-4.0                       4.0.3-1    The GNU C compiler
ii  gcc-4.0-base                  4.0.3-1    The GNU Compiler Collection (base 
ii  libc6                         2.3.6-3    GNU C Library: Shared libraries an
ii  libstdc++6-4.0-dev            4.0.3-1    The GNU Standard C++ Library v3 (d

g++-4.0 recommends no packages.

-- no debconf information
.PHONY: all clean

CXX=g++ -Wall
CC=gcc -Wall

all: array.cc.o array.c.o

array.cc.o : array.cc
	${CXX} -o $@ -c $^
	ls -l $@

array.c.o : array.c
	${CC} -o $@ -c $^
	ls -l $@

array.cc : gen_array
	./gen_array > $@

array.c : gen_array
	./gen_array > $@

gen_array : gen_array.o
	${CC} -o $@ $^

gen_array.o : gen_array.c
	${CC} -c $^

clean:
	rm -vf *.o array.*c gen_array
// generates an C/C++ array file.

#include <stdio.h>

int main()
{
	int i;
	printf("const int Table[] = {\n");
	for(i = 0; i<1000; ++i)
	{
		printf("\t%d,\n", i);
	}
	printf("\t};\n");
	return 0;
}

--- End Message ---
--- Begin Message ---
Markus Schaber <schabi@logix-tt.com> writes:

> G++ seems to drop const int arrays, while gcc compiles them correctly.

Not a bug:

3.5/3 A name having namespace scope (3.3.5) has internal linkage if it
is the name of [...] an object or reference that is explicitly
declared const and neither explicitly declared extern nor previously
declared to have external linkage; [...]

-- 
	Falk

--- End Message ---

Reply to: