473,666 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[MC++] Internal Compiler Error with /Ox

I am not sure if this is related to my previous thread
("NullReference Exception with value struct") so I am starting a new
thread.

I saw in
http://msdn.microsoft.com/library/de...nagedtypes.asp

they mention that value types cannot contain pointers to other managed
types. In my __value struct, I had an array of other __value objects,
so I changed it to an unmanaged array. Now, when I compile using /Ox
for full optimization, I get an Internal Compiler Error.

Can anybody propose a workaround? Upgrading to VS 2005 is not an option
at the time.
// Test.h
#pragma once

#using <mscorlib.dll >
#using <System.dll>
#using <System.Windows .Forms.dll>

namespace ICE
{
public __gc class Test : public System::Windows ::Forms::Form
{
public:
Test(void) { }

static const int max_contours = 5;

__value struct Contours {
int num_contours;

__value struct ContourInfo {
double lower_bound;
int r;
int g;
int b;
} contours __nogc[max_contours];

//ContourInfo contours[];

//Contours()
// : contours(new ContourInfo[max_contours])
//{ }
};

protected:
void Dispose(System: :Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispos e(disposing);
}

private:
/// <summary>
/// Required designer variable.
/// </summary>
System::Compone ntModel::Contai ner* components;

private:
bool is_blank(const Contours& contours)
{
Contours::Conto urInfo empty = {0, 0, 0, 0};
bool blank = true;
for (int i = 0; i < contours.num_co ntours; ++i) {
if (!__box(contour s.contours[i])->Equals(__box(e mpty))) {
blank = false;
}
}

return blank;
}
};
}
// Test.cpp
#include "Test.h"
#include <windows.h>

#using <mscorlib.dll >

int main()
{
ICE::Test* t = new ICE::Test;
}
Compile command:
cl /clr /Ox Test.cpp
Output:
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

Test.cpp
c:\documents and settings\kwokmb 1\my documents\work\ code\test.h(61) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'f:\vs70builds\ 3077\vc\Compile r\Utc\src\p2\wv m\mdmiscw.c', line 754)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Note: The compiler file they list above does not exist on my system.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
May 15 '06 #1
1 1639
Marcus Kwok <ri******@gehen nom.invalid> wrote:
I saw in
http://msdn.microsoft.com/library/de...nagedtypes.asp

they mention that value types cannot contain pointers to other managed
types. In my __value struct, I had an array of other __value objects,
so I changed it to an unmanaged array. Now, when I compile using /Ox
for full optimization, I get an Internal Compiler Error.
It turns out that any of the optimization switches I tried resulted in
the ICE.
Can anybody propose a workaround? Upgrading to VS 2005 is not an option
at the time.

bool is_blank(const Contours& contours)
{
Contours::Conto urInfo empty = {0, 0, 0, 0};
bool blank = true;
for (int i = 0; i < contours.num_co ntours; ++i) {
if (!__box(contour s.contours[i])->Equals(__box(e mpty))) {
blank = false;
}
}

return blank;
}


I changed this to

bool is_blank(const Contours& contours)
{
bool blank = true;
for (int i = 0; i < contours.num_co ntours; ++i) {
if ((contours.cont ours[i].lower_bound != 0.0) ||
(contours.conto urs[i].r != 0) ||
(contours.conto urs[i].g != 0) ||
(contours.conto urs[i].b != 0)) {
blank = false;
}
}

return blank;
}

and I no longer get the ICE.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
May 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8619
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to build my gui and dll projects, whose project, workspace, source files all resided on network drive mapped to H. The H mapping,
16
2846
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...) Oh, I forgot to list the error messages; I would be delighted if someone could explain how to deduce which line number in which file is the one that the VC compiler cannot handle. Actually I'm using C#, but the only post I could find about...
1
13218
by: Ayende Rahien | last post by:
reparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error (0xc0000005 at address 53168B12): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem,
4
3315
by: David Sworder | last post by:
Consider the following line of code (it's not important what it does): resp.DocItem=Relations.SelectDocItems_BySearchString(req.SearchPhrase); It turns out that this line is in error. The property 'DocItem' should be 'DocItems.' The problem is that instead of notifying me of where the problem has occurred, the compiler just crashes with an "internal error" (see bottom of this message). Now if I were to write: ...
8
4503
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock problem and the potential for deadlocks. After pouring over the available information, and trying a few experiments, I am still left with a few questions and issues I hope someone out there can shed some light on.
2
2510
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a pointer or reference to a derived type of the base class's return type. In .NET the overridden virtual function is similar, but an actual parameter of the function can be a derived reference from the base class's reference also. This dichotomy...
1
1112
by: mahesh | last post by:
I am trying to pass C# object to MC++ as one of the method Parameter. I am getting following Fatal error. fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information
0
1605
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is that when I ran it and looked at memory usage (in Windows task manager) it looked as if there was a very slow leak. To isolate the issue:
8
2197
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the existing code. The options I've considered so far: 1. Create a new MC++ GUI project and add the *.c files to them and mark them with pragma unamanged. However, the /clr option does not compile *.c files, so I rename them to *.cpp, and now they...
0
8787
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8645
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.