Date: Mon, 28 Sep 1998 16:37:28 +0300 (IDT) From: Eli Zaretskii To: "EFT.Eric Devolder" cc: djgpp AT delorie DOT com Subject: Re: Program goes wrong when optimized under gcc 2.8 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 28 Sep 1998, EFT.Eric Devolder wrote: > > When I compile the program like this: gcc -o hot2std.exe hot2std.c > > it works perfeclty. > > If I try to compile with optimization (gcc -O[1,2 or 3] -o hot2std.exe > > hot2std.c), I get strange outputs, compared to those of the debug > > version. This line is the villain: sprintf(temp,"0002%06.6ldA%019.19s \n" This produces 33 characters, including the terminating '\0', whereas temp[] is declared as "char temp[32];". I don't know whether there are any more problems in your program.