Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by John Carlson
Wed, 02 Sep 1992 09:01
Increment isn't done before assigment in unoptimized version
Author: John Carlson
Date: Wed, 02 Sep 1992 09:01
Date: Wed, 02 Sep 1992 09:01
31 lines
988 bytes
988 bytes
Machine: Sparcstation 2
OS: Sun OS 4.1.1
Compiler: gcc-2.2.2
The follow program gives difference result when compiled with
and without the -O option to gcc.
#include <stdio.h>
main ()
{
int i = 0;
i = i++;
printf("should be 1->%d\n", i);
}
The unoptimized version prints:
should be 1->0
The optimized version prints:
should be 1->1
Guess the moral of the story is to use the optimized version.
Either that or I was too tired when programming.
(Yeay! The program works now!)
John Carlson
carlson@yottzumm.tis.llnl.gov
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads