public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51900] New: [4.6 Regression] const variable initialization always zero
@ 2012-01-19 10:48 daniel.f.starke at freenet dot de
  2012-01-19 11:29 ` [Bug target/51900] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: daniel.f.starke at freenet dot de @ 2012-01-19 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51900
           Summary: [4.6 Regression] const variable initialization always
                    zero
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.f.starke@freenet.de
              Host: mingw32
            Target: mingw32
             Build: mingw32


/* a.c */
#include "a.h"
const int myVar[3] = { 5, 6, 7 };

/* a.h */
#ifndef a_h
#define a_h
const int myVar[3];
#endif

/* main.c */
#include <stdio.h>
#include "a.h"
void main() {
 int i;
 for (i = 0; i < 3; i++) printf("myVar[%i] = %i\n", i, myVar[i]);
 fflush(stdout);
}

Result gcc 4.5.2:
myVar[0] = 5
myVar[1] = 6
myVar[2] = 7

Result gcc 4.6.2:
myVar[0] = 0
myVar[1] = 0
myVar[2] = 0

Configurations:
Using built-in specs.
COLLECT_GCC=D:\Programme\msys\mingw452\bin\gcc.exe
COLLECT_LTO_WRAPPER=d:/programme/msys/mingw452/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure
--enable-languages=c,ada,c++,fortran,java,objc,obj-c++
--disable-sjlj-exceptions --disable-nls --disable-shared --enable-static
--enable-libgcj --enable-libgomp --enable-lto --with-dwarf2
--disable-win32-registry --enable-version-specific-runtime-libs --prefix=/mingw
--program-suffix= --build=mingw32 --enable-abi=32 --enable-checking=release
Thread model: win32
gcc version 4.5.2 (GCC)

Using built-in specs.
COLLECT_GCC=D:\Programme\msys\mingw462\bin\gcc.exe
COLLECT_LTO_WRAPPER=d:/programme/msys/mingw462/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure
--enable-languages=c,ada,c++,fortran,objc,obj-c++ --disable-sjlj-exceptions
--disable-nls --disable-shared --enable-static --enable-libgcj --enable-libgomp
--enable-lto --with-dwarf2 --disable-win32-registry
--enable-version-specific-runtime-libs --build=mingw32 --enable-abi=32
--enable-checking=release --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)

Compiled with:
CC = gcc
CFLAGS = -static -O2
LDFLAGS = -static

all: main.exe

.PHONY: clean
clean:
    rm -f *.o
    rm -f *.exe

main.exe: main.o a.o
    $(CC) $(LDFLAGS) -o main.exe main.o a.o

main.o: main.c
    $(CC) $(CFLAGS) -o main.o -c main.c

a.o: a.c
    $(CC) $(CFLAGS) -o a.o -c a.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-01-23 20:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 10:48 [Bug c/51900] New: [4.6 Regression] const variable initialization always zero daniel.f.starke at freenet dot de
2012-01-19 11:29 ` [Bug target/51900] " rguenth at gcc dot gnu.org
2012-01-19 12:01 ` mikpe at it dot uu.se
2012-01-19 12:18 ` daniel.f.starke at freenet dot de
2012-01-19 12:21 ` rguenth at gcc dot gnu.org
2012-01-19 15:03 ` daniel.f.starke at freenet dot de
2012-01-19 15:04 ` rguenth at gcc dot gnu.org
2012-01-19 15:16 ` [Bug target/51900] [4.6/4.7 " rguenth at gcc dot gnu.org
2012-01-20  2:50 ` ktietz at gcc dot gnu.org
2012-01-20  7:52 ` jakub at gcc dot gnu.org
2012-01-20  7:54 ` daniel.f.starke at freenet dot de
2012-01-21  0:00 ` d.g.gorbachev at gmail dot com
2012-01-23 20:38 ` ktietz at gcc dot gnu.org
2012-01-23 21:17 ` ktietz at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).