KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q51642: QuickC 2.00: /Ot Code Generation Error

Article: Q51642
Product(s): See article
Version(s): 2.00 2.01
Operating System(s): MS-DOS
Keyword(s): ENDUSER | s_quickasm buglist2.00 buglist2.01 | mspl13_c
Last Modified: 21-MAR-1990

The following small program, when compiled under QuickC Version 2.00
or 2.01, with /Ot included in the optimizations, generates the wrong
code.

With /Ot, the output is as follows:

   array [0] = 0

The correct output is as follows:

   array [0] = 1

The error occurs in the code generated for the following:

   array[index] = test;

/* Ot.c: /Ot optimization error */

#include <stdlib.h>
#include <stdio.h>

int array[4];

void main(void)
{
     int index = 0,
          test;

     test = atoi("1");

     array[index] = test;

     printf("array [%d] = %d \n", index, array[index]);
}

Microsoft has confirmed this to be a problem with QuickC Versions 2.00
and 2.01. We are researching this problem and will post new
information here as it becomes available.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.