Prev: Atarax cheapest. Lowest prices for Atarax online. Atarax how much can you take. Next day delivery on Atarax saturday.
Next: Buy online HYDROCODONE, order prescription free HYDROCODONE, cheap HYDROCODONE next day
From: yaqi on 28 Apr 2010 13:18 MODULE mytype TYPE mytype INTEGER, POINTER, DIMENSION(:) :: ptr END TYPE mytype CONTAINS ! rename a to b SUBROUTINE rename(a, b) IMPLICIT NONE TYPE(mytype) :: a TYPE(mytype) :: b b%ptr => a%ptr NULLIFY(a%ptr) RETURN END SUBROUTINE rename END mytype PROGRAM test USE mytype IMPLICIT NONE TYPE(mytype) :: a, b INTEGER :: i ! create a ALLOCATE(a%ptr(100)) a%ptr = 1 CALL rename(a, b) ! then we can use b DO i = 1, 100 b%ptr(i) = i ENDDO STOP END PROGRAM ------------------------- I have a large code doing the similar thing. And when I turn O3 on with Intel Visual Fortran compiler. The code crashes and I am pretty sure it is the 'rename' subroutine that causes the problem. But I did not see anything wrong in it. Is there any danger in 'rename' which is not so obvious? Many thanks!
From: yaqi on 28 Apr 2010 13:24 Btw, the version of my IVF compiler is 11.1.054. On Apr 28, 11:18 am, yaqi <yaqiw...(a)gmail.com> wrote: > MODULE mytype > > TYPE mytype > INTEGER, POINTER, DIMENSION(:) :: ptr > END TYPE mytype > > CONTAINS > > ! rename a to b > SUBROUTINE rename(a, b) > IMPLICIT NONE > TYPE(mytype) :: a > TYPE(mytype) :: b > b%ptr => a%ptr > NULLIFY(a%ptr) > RETURN > END SUBROUTINE rename > > END mytype > > PROGRAM test > USE mytype > IMPLICIT NONE > > TYPE(mytype) :: a, b > INTEGER :: i > > ! create a > ALLOCATE(a%ptr(100)) > a%ptr = 1 > > CALL rename(a, b) > > ! then we can use b > DO i = 1, 100 > b%ptr(i) = i > ENDDO > > STOP > END PROGRAM > > ------------------------- > > I have a large code doing the similar thing. And when I turn O3 on > with Intel Visual Fortran compiler. The code crashes and I am pretty > sure it is the 'rename' subroutine that causes the problem. But I did > not see anything wrong in it. Is there any danger in 'rename' which is > not so obvious? > > Many thanks!
From: Steve Lionel on 28 Apr 2010 13:43 On 4/28/2010 1:18 PM, yaqi wrote: > MODULE mytype snip... > > > I have a large code doing the similar thing. And when I turn O3 on > with Intel Visual Fortran compiler. The code crashes and I am pretty > sure it is the 'rename' subroutine that causes the problem. But I did > not see anything wrong in it. Is there any danger in 'rename' which is > not so obvious? It is evident that you retyped in the code as you showed it here, as it has several syntax errors. When I correct the syntax errors and build it with /O3 and Intel Visual Fortran 11.1.054 (and 11.1.065), it runs fine. I conclude, then, that the code you showed here is not representative of your actual code. Paraphrases and uncompilable excerpts do not help in getting your problem resolved. Please provide an actual test case. I'd also recommend that you take this to our user forum at http://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/ where we can help you better. -- Steve Lionel Developer Products Division Intel Corporation Nashua, NH For email address, replace "invalid" with "com" User communities for Intel Software Development Products http://software.intel.com/en-us/forums/ Intel Software Development Products Support http://software.intel.com/sites/support/ My Fortran blog http://www.intel.com/software/drfortran
From: Richard Maine on 28 Apr 2010 13:59 yaqi <yaqiwang(a)gmail.com> wrote: > I have a large code doing the similar thing. And when I turn O3 on > with Intel Visual Fortran compiler. The code crashes and I am pretty > sure it is the 'rename' subroutine that causes the problem. But I did > not see anything wrong in it. Is there any danger in 'rename' which is > not so obvious? Standard answer number 1 applies: If you understood the problem you would not be needing to ask for help. If you want any odds of getting decent help, you need to show the actual problem rather than something that illustrates what you think the problem is. We can't debug code by looking at something that isn't the code to be debugged and probably doesn't illustrate it at all. Your judgement of what is "simillar" isn't enough and is most likely wrong. Odds are that it has no simillarity to the actual source of the bug. Yes, there are multiple problems in the code shown, but none of them are very "interesting". Since they result in compilation errors, they are unlikely to be simillar to anything that causes run-time crashes. Throw the posted code at any compiler if you care to see them, but that's unlikely to help with the real problem. Unless your problem relates to using the same name for two different things (a module and a derived type) or to syntax errors in END statements, we pretty much have no information to help you with. Nothing else in the code posted looks worth comment. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: yaqi on 28 Apr 2010 14:03
Hi Steve, Many thanks! And sorry I am too confident and not test the sample program I attached here. The problem is that the actual code is so large and propertery that I am sure no one want to really look into it. I add few print statements in my actual code at the beginning of rename and after. Something like: SUBROUTINE rename(a, b) IMPLICIT NONE TYPE(mytype) :: a TYPE(mytype) :: b print *, associated(a%ptr), associated(b%ptr), size(a%ptr), size(b %ptr) b%ptr => a%ptr NULLIFY(a%ptr) print *, associated(a%ptr), associated(b%ptr), size(a%ptr), size(b %ptr) RETURN END SUBROUTINE rename And I saw the second print did not give me the expected output. Although a%ptr is not associated, its size is not zero. (I guess it is not specified in the Fortran reference.) This is tolerable. On the other hand, b%ptr is associated but its size is not equal to the size of a%ptr in the first print statement. It gave me 1! If I run the code under Debug mode, everything is just fine. I am sorry I can not provide the actual code. On Apr 28, 11:43 am, Steve Lionel <steve.lio...(a)intel.invalid> wrote: > On 4/28/2010 1:18 PM, yaqi wrote: > > > MODULE mytype > snip... > > > I have a large code doing the similar thing. And when I turn O3 on > > with Intel Visual Fortran compiler. The code crashes and I am pretty > > sure it is the 'rename' subroutine that causes the problem. But I did > > not see anything wrong in it. Is there any danger in 'rename' which is > > not so obvious? > > It is evident that you retyped in the code as you showed it here, as it > has several syntax errors. When I correct the syntax errors and build > it with /O3 and Intel Visual Fortran 11.1.054 (and 11.1.065), it runs fine. > > I conclude, then, that the code you showed here is not representative of > your actual code. Paraphrases and uncompilable excerpts do not help in > getting your problem resolved. Please provide an actual test case. I'd > also recommend that you take this to our user forum athttp://software.intel.com/en-us/forums/intel-visual-fortran-compiler-... > where we can help you better. > > -- > Steve Lionel > Developer Products Division > Intel Corporation > Nashua, NH > > For email address, replace "invalid" with "com" > > User communities for Intel Software Development Products > http://software.intel.com/en-us/forums/ > Intel Software Development Products Support > http://software.intel.com/sites/support/ > My Fortran blog > http://www.intel.com/software/drfortran |