Mail Archives: djgpp/1998/09/28/09:54:49
> ----------
> From: Eli Zaretskii[SMTP:eliz AT is DOT elta DOT co DOT il]
> Sent: lundi 28 septembre 1998 14:39
> To: EFT.Eric Devolder
> Subject: Re: Program goes wrong when optimized under gcc 2.8
>
>
> 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.
>
>
I've made the change, but the problem still remain. I really don't know
what is the problem.
If you want to have a run, just perform
gcc -O3 -o hot2std.exe hot2std.c (to get a buggy version)
gcc -g -o hot2std.exe hot2std.c (to get a working version)
then
hot2std raw (and compare output of both versions);
- Raw text -