- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm porting some code from Linux -> Windows and getting an odd optimization-dependent error.
Essentially, when I compile with Intel C Compiler 11.066 (WinXP64 install, 32-bit target) with /O2 I get an error of the following form:
0xC0000005: Access violation reading location 0xffffffff.
at the following location:
else if(gb_algorithm==egbOBC) {
for(i=0;i {
rbi = born->bRad;
rb = rbi * rbi * born->drobc * dvda;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
}
For what it's worth, the MS debugger reports the value of i equal to natoms.
If I recompile with /Od, the code runs.
Most interestingly, the following change makes the code work with /O2:
1617a1618
> volatile int idx;
1641c1642
< for(i=0;i ---
> for(idx=0;idx 1643,1644c1644,1645
< rbi = born->bRad;
< rb = rbi * rbi * born->drobc * dvda;
---
> rbi = born->bRad[idx];
> rb[idx] = rbi * rbi * born->drobc[idx] * dvda[idx];
Any thoughts on what might be causing this?
I'm porting some code from Linux -> Windows and getting an odd optimization-dependent error.
Essentially, when I compile with Intel C Compiler 11.066 (WinXP64 install, 32-bit target) with /O2 I get an error of the following form:
0xC0000005: Access violation reading location 0xffffffff.
at the following location:
else if(gb_algorithm==egbOBC) {
for(i=0;i
rbi = born->bRad;
rb = rbi * rbi * born->drobc * dvda;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
}
For what it's worth, the MS debugger reports the value of i equal to natoms.
If I recompile with /Od, the code runs.
Most interestingly, the following change makes the code work with /O2:
1617a1618
> volatile int idx;
1641c1642
< for(i=0;i
> for(idx=0;idx
< rbi = born->bRad;
< rb = rbi * rbi * born->drobc * dvda;
---
> rbi = born->bRad[idx];
> rb[idx] = rbi * rbi * born->drobc[idx] * dvda[idx];
Any thoughts on what might be causing this?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please use the work-around for now. It is a bug in the compiler at -O2.
I tried with a simple testcase, it does not duplicate the problem. Is it possible for you to create a small testcase?
mytest.cpp: icl /O2 mytest.cpp.
I tried with a simple testcase, it does not duplicate the problem. Is it possible for you to create a small testcase?
mytest.cpp: icl /O2 mytest.cpp.
[cpp]#define mysize 100 int main(void) { int i = mysize; int natoms = mysize; struct { float bRad[mysize]; float drobc[mysize]; } temp, *born; float rb[mysize], dvda[mysize]; float rbi; born = &temp; for(i=0;ibRad; rb = rbi * rbi * born->drobc * dvda; } return 0; }[/cpp]

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page