This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Information regarding issue with While Loop with O3 optimization


Hello all,
    I am encountering a strange problem. I have a code
Snippet that contains a while loop.

The snippet is as follows:

     While( (expr1) && (expr2) );

    Initially the value of both expr1 and expr2 are
Set to 1.

Next, only the value of expr1 is set to 0 within a 
SIGINT handler.

I compile this program with -O3 optimization. The gcc
Version information is as follows:
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)

When I run this program, it goes into a tight loop.
Now when I send a SIGINT to this program,
Then the program is not exiting.

I repeat the same procedure by compiling the same
code with -O0 optimization option. Now when I
Send the SIGINT signal the program exits

Has anyone encountered similar kind of behavior?
Is there any issue with GCC 4.1.1 related to O3 optimization
Option.?

Regards
Raghu.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]