473,548 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BUG: Incorrect / inconsistent program behaviour when the "Remove Integer Overflow Checks" option is enabled

This is a worrying bug, and indicates a potential problem in the Framework
CLR. This bug affected a project I was working on, which behaved differently
when run from the Visual Studio IDE than when run by double clicking on the
project's EXE file. The problem can be replicated easily:

Create a new project in Visual Studio 2003 and add the following code.
Module Main
Sub Main()
Dim xmlDoc As New System.Xml.XmlD ocument
xmlDoc.AppendCh ild(xmlDoc.Crea teElement("Root "))
Dim o, n As Object
Dim count As Integer
For Each o In xmlDoc.ChildNod es
For n = 0 To 9
count += 1
Next
Next
System.Windows. Forms.MessageBo x.Show("Count: " & count)
End Sub
End Module
IMPORTANT: To replicate the bug, you must

(1) Set the project compile mode to "Release"
(2) Enable the following option: Project Configuration Properties /
Optimisations / "Remove Integer Overflow Checks"

Finally, run the program from the Visual Studio IDE. The expected message,
"Count: 10", is displayed. Now run the program from it's EXE file via
Windows Explorer. A message, "Count: 1" is displayed, which is incorrect.
Nov 20 '05 #1
3 1363
Ralph,

Interesting, that does indeed look like some kind of JIT compiler bug.

FYI, changing the loop variable n to an Integer fixes the problem. Why
did you have it declared as Object anyway?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 20 '05 #2
I know it fixes it, but I wanted to show the problem. Actually, changing the
code in almost any way fixes the problem.

It's a rather worrying thought that this kind arbitrary JIT compiler problem
might affect anyone's code.

So, there was no specific reason for the Object declaration, other than the
fact that I wanted to provide a simple example that did not break the
problem. (In my shipping code I used a For / Each for the inner loop, not an
object).
"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:et******** ******@TK2MSFTN GP10.phx.gbl...
Ralph,

Interesting, that does indeed look like some kind of JIT compiler bug.

FYI, changing the loop variable n to an Integer fixes the problem. Why
did you have it declared as Object anyway?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 20 '05 #3
Ralph,
I know it fixes it, but I wanted to show the problem. Actually, changing the
code in almost any way fixes the problem.
OK, fine. FWIW, the bug seems to be fixed in Whidbey.

It's a rather worrying thought that this kind arbitrary JIT compiler problem
might affect anyone's code.


Well, there will always be bugs.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 20 '05 #4

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

Similar topics

1
2579
by: aj | last post by:
DB2 v8 FP5 Red Hat AS/EL 2.1 I found the following in my db2diag.log: 2004-09-07-10.01.37.747898 Instance:oltp Node:000 PID:14637(db2agent (NDRDB)) TID:8192 Appid:C0455584.K508.00E507141135 access plan manager sqlra_cache_mem_please Probe:21 Database:NDRDB Package Cache Number Overflows
1
3461
by: BillCo | last post by:
I've been running a text-to-table import as part of a daily routine for years and I've just added a few new fields and updated the import spec. The strange thing is that it works perfectly when importing to a local table, but once I try to run it on an identical linked table it spits up a "numeric field overflow" error. In the past it has...
3
2613
by: poifull | last post by:
Hi All, What is the proper way to read a binary file into a byte? I am using BinaryReader to read from a Stream and call the ReadByte method of the BinaryReader object. The method I'm using leads to the second question. I got the "Conversion buffer overflow" error when I run the following code: Stream s = openFileDialog1.OpenFile();
2
5145
by: SAL | last post by:
I have the following line of code in my Page_Load Event of my ASP.net page: txtExplanationofChange.Attributes.Add ("style","overflow :hidden"); which allows me to can turn off the Scrollbar of my multiline textbox. I am still fairly new to developing in ASP.net and C#, and I'm not sure if there is a better way to disable the scrollbar. The...
2
2246
by: ppuniversal | last post by:
hello, my program snippet: /*****************************/ /******runThread Function*****/ /*to accept other client connections*/ /*****************************/ DWORD WINAPI runThread(LPVOID param)
20
12385
by: chutsu | last post by:
I'm trying to compare between pointer and integer in an "IF" statement how do I make this work? if(patient.id != NULL){ } Thanks Chris
3
9433
by: _Christopher\(M2M\) | last post by:
Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) How do I get rid of "Warning C4307: '-' : integral constant overflow" from the following macro? #define d_ReturnMax(I_iTypeSize)\ ( (int64(1)<<((I_iTypeSize*8)-1))-1) There NO warnings when done as a function: int64 d_ReturnMax(int64 I_iTypeSize) { return...
0
1362
by: snowdream1982 | last post by:
Dear all, I hit an error OVERFLOW but when I insert the sql statement below manually in the SQLEditor, it goes well, no errors at all. My coding: SQLInsertTempMf = "INSERT INTO tempmf " & _ "(scn, bl_num,master_ind,cin_num,master_bl,container_no, consignee_code, consignee_name,consignee_addr1, " & _ ...
1
2978
by: rileyjane | last post by:
Hello, I am running a Union query in Access 2003 that combines two other queries. When I run each query individually, they open fine with no problems. But when I try to run the Union query, I get the Overflow message. I have seen in other posts that the Overflow message usually comes up when a query operation provides a result that is too...
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7803
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...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5082
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...
0
3495
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...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
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...

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.