home *** CD-ROM | disk | FTP | other *** search
- Q33000 Incorrect Code with /Ox and Pointer Assignments
- C Compiler
- 5.10 | 5.10
- MS-DOS | OS/2
-
- Summary:
- The code generated for the program below is incorrect when compiled
- with full optimization (/Ox). The compiler is attempting to associate
- the variable top with the variable p1 in the "while loop" even though
- the value of top changed after the assignment to p1.
- Microsoft has confirmed this to be a problem in Version 5.10 of the
- C compiler. We are researching this problem and will post new
- information as it becomes available.
- You can work around this problem by changing the code as follows:
-
- unsigned *p1, *p2, *bottom, *top;
-
- fun()
- {
- ++top;
- p1 = top - 1;
- p2 = top;
- while (p1 >= bottom) * p2-- = *p1--;
- }
-
- More Information:
- The following is the program that is causing the error:
-
- unsigned *p1, *p2, *bottom, *top;
-
- fun()
- {
- p1=top;
- p2=++top;
- while (p1 >= bottom)
- *p2-- = *p1--;
- }
-
-
-
- Keywords: buglist5.10 qfbv
- Updated 88/07/29 12:16
-