home *** CD-ROM | disk | FTP | other *** search
- Q32540 Incorrect Code with /Oal /AL and Nested Loops
- C Compiler
- 5.10 | 5.10
- MS-DOS | OS/2
-
- Summary:
- The code generated for the following program is incorrect when
- compiled with /Oal /AL. When you are looking at the generated code,
- the SI register is used in the outer loops to keep track of argc.
- However, within the loop, the SI register is corrupted and the loop
- will not terminate.
- Microsoft has confirmed this to be a problem in Version 5.10. We
- are researching this problem and will post new information as it
- becomes available.
-
- More information:
- The following code reproduces this problem:
-
- #define MAX_PATH_CHARS 80
- #define FILE_NAME_SIZE 80
- #define incr(i) ++(i)
- #define decr(i) --(i)
- #define NUL '\0'
-
- char buffer[MAX_PATH_CHARS];
-
- #define USAGE "usage: %s [ -d dir ] [ file ]\n"
- int
- decode_args (argc, argv)
- int argc;
- char* *argv;
- {
- int j;
- char* ap;
- char dir[MAX_PATH_CHARS];
-
- int last;
-
- while (argc) {
- if (argv[0][0] == '-') {
- for (ap = *argv + 1; *ap != NUL; incr(ap)) {
- decr(argc), incr(argv);
- strcpy(dir, *argv);
- }
- } else
- while (j <= FILE_NAME_SIZE && argv[0][j] != NUL) {
- buffer[last] = argv[0][j];
- incr(last), incr(j);
- }
- decr(argc), incr(argv);
- }
- }
-
-
-
- Keywords: buglist5.10
- Updated 88/07/21 03:19
-