🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.win32
Article #2113

BUG REPORT: Microsoft Visual C++ 4.1

#2113
From: Gary Edstrom
Date: Thu, 04 Apr 1996 22:14
44 lines
1731 bytes
/* BugDemo.cpp

   Here is a demonstration of a serious bug that I just found in Microsoft
   Visual C++ Version 4.1. (The bug also exists in version 4.0).  When this
   program is compiled with all of the default options in the debug mode, the
   first of the two *= lines below fail to generate any code.  When compiled
   in the release mode, everything is OK.  The problem also goes away in the
   debug mode if you change the optimizations from "debug" to "compile for '
   speed".  Note that the only difference between the first and second 
   versions of the line is the use of a constant for the index rather than a 
   variable.

  This sample was created as a console application.
*/

#include <stdio.h>

struct {
    int a;
    int b;
    int c;
    int d;
    int e;
} X[1] = { 1,2,3,4,5 };

int main( void)
{

    int i = 0;

    X[i].a *= 2;  // <<<ERROR - No code generated in debug mode

    X[0].b *= 2; // This line works OK in either mode.

    printf( "a = %d, b = %d.\n", i, X[0].a, X[0].b );

    return 0;
}

--
Gary Edstrom <gbe@primenet.com> | Sequoia Software
PO Box 9573                     | Programming & Technical Services
Glendale CA 91226-0573          | PGP Key ID: 0x1A0D44BD
PGP Fingerprint: 72 AA 4F 73 05 53 89 C6  8A EE F4 EE D1 C0 13 8D 
Technical Details
Message-ID: <316445a3.428887193@news.primenet.com>
Path: arc1-ca.pugleaf.net!news.primenet.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.primenet.com!not-for-mail
From: gbe@primenet.com (Gary Edstrom)
Newsgroups: comp.os.ms-windows.programmer.win32,comp.lang.c++
Subject: BUG REPORT: Microsoft Visual C++ 4.1
Date: 4 Apr 1996 15:14:01 -0700
Organization: Sequoia Software
Sender: root@primenet.com
Message-ID: <316445a3.428887193@news.primenet.com>
X-Posted-By: ip238.lax.primenet.com
X-Newsreader: Forte Agent .99d/32.182