Return from SUBROUTINE: 0xC0000005: Access violation reading location 0xfffffffc.

Return from SUBROUTINE: 0xC0000005: Access violation reading location 0xfffffffc.

When calling a subroutine that "exits early" due to failed input parameter value validation I get:

Unhandled exception at 0x003d0541 in vmpsI.exe: 0xC0000005: Access violation reading location 0xfffffffc.

The subroutine and calling program are attached.

  o  When calling the subroutine with a value of N less than 6 the runtime error is ALWAYS encountered.

   o  When calling with N=6 it OCCASIONALLY will return to the calling program as expected.

   o  ONCE I got a fatal heap corruption error.

  o  The SUBROUTINE follows.  Note that "SomeArray" must be declared to generate the RTE.

! ThisIsBS.
!
! Minimal routine to generate the WTF runtime error.


        SUBROUTINE ThisIsBS(S, N, D, H1Vals, H2Vals, info)

        IMPLICIT NONE


        ! Generic two-dimensional array.
        TYPE Array2d
            SEQUENCE
            DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:) :: val
        END TYPE Array2d


        INTEGER, INTENT(IN) :: S
        INTEGER, INTENT(IN) :: N
        INTEGER, INTENT(IN) :: D
        DOUBLE PRECISION, DIMENSION(S,S), INTENT(IN) :: H1Vals
        DOUBLE PRECISION, DIMENSION(S,S), INTENT(IN) :: H2Vals
        INTEGER, INTENT(OUT) :: info


        DOUBLE PRECISION :: foo
        INTEGER :: bar
        INTEGER :: baz


        ! This is an array that WOULD HAVE been used later in the subroutine
        ! had the validations passed.  So please don't submit this code to
        ! TheDailyWTF.com.  I just ripped out EVERYTHING from the subroutine
        ! but this, WHICH IS BLOWING THIS DAMNED THING UP!!!!!!!!!!!!!!!!!!!
        TYPE(Array2d), DIMENSION(0:N+1,1:N) :: SomeArray


        ! Initialize the return value.
        info = 0

        ! Ensure the value of N is valid.
        IF (N < 4) THEN
            info = -1
            GOTO 999
        ENDIF

        ! Ensure the value of D is greater than zero.
        IF (D < 1) THEN
            info = -2
            GOTO 999
        ENDIF

        ! Ensure the value of D is a power of 2.
        IF (D /= 2**INT(LOG(D*1.) / LOG(2.))) THEN
            info = -3
            GOTO 999
        ENDIF

        ! Ensure the values of N and D are valid and compatible.  Specifically
        ! D may not be "too big" for N.
        IF (D > 2**INT((N-4)/2)) THEN
            info = -4
            GOTO 999
        ENDIF


999     RETURN

        END

  o  The calling program follows.

! Run Variational Matrix Product States (VMPS).
!
! This program will run the VMPS routine.


        PROGRAM RunVMPS

        IMPLICIT NONE

        ! The number of spin states per particle.
        INTEGER, PARAMETER :: S=2

        ! The number of particles in the chain.
        INTEGER :: N

        ! The maximum bond dimension.
        INTEGER :: D


        ! The values of the matrix elements of the DxD one- and two-body operators that
        ! make up the nearest neighbor Hamiltonian (for spin 1/2):
        !
        !  | <up|O|up> <up|O|dn> |
        !  | <dn|O|up> <dn|O|dn> |
        !
        ! Here we define two arrays:
        !   o  H1Vals for the matrix elements of the one-body operator.
        !   o  H2Vals for the matrix elements of the two-body operator.
        DOUBLE PRECISION, DIMENSION(S,S) :: H1Vals
        DOUBLE PRECISION, DIMENSION(S,S) :: H2Vals

        ! Return value from the VMPS routine.
        INTEGER :: info


        ! Initialize the matrix elements of the operators.
        ! Since the values in Fortran arrays are stored in column major order, these
        ! values correspond to <up|O|up>, <dn|)|up>, <up|O|dn>, and <dn|O|dn>,
        ! respectively. To convert these values into their 2x2 matrix we use:
        !
        !     TRANSPOSE(RESHAPE(..., (/ 2, 2 /)))
        !
        H1Vals = TRANSPOSE(RESHAPE((/ -1.0d0, 0.0d0, 0.0d0, 1.0d0 /), (/ 2, 2 /)))
        H2Vals = TRANSPOSE(RESHAPE((/ 0.0d0, 1.0d0, 1.0d0, 0.0d0 /), (/ 2, 2 /)))

        WRITE(*,*) "I am alive."

        N=4
        D=3
        CALL ThisIsBS(S,N,D,H1Vals,H2Vals,info)

        WRITE(*,*) "I am dead."


        STOP

        END

 

My environment:

  o  Windows 7 Ultimate 64 bit SP1

  o  Visual Studio 2010 Premium

  o  Intel(R) Visual Fortran     Package ID: w_fcompxe_2013_sp1.1.139

  o  Intel(R) Visual Fortran Composer XE 2013 SP1 Update 1 Integration for Microsoft Visual Studio* 2010, 14.0.0074.2010, Copyright (C) 2002-2013 Intel Corporation

AllegatoDimensione
Download RunVMPS.f901.68 KB
Download ThisIsBS.f901.78 KB
16 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hello Richard,

>>>When calling the subroutine with a value of N less than 6 the runtime error is ALWAYS encountered.

In the attached example RunVMPS.f90, you have  N=4, so this should reproduce the issue, but I cannot; the problem might be specific to update #1.

I can't reproduce an access violation with update #2; the output seems to be correct.  Did I miss something?  Does SomeArray need to be accessed to reproduce?

Otherwise, I suggest you give update #2 a try.

Thanks,

patrick

C:\ISN_Forums\U507067>ifort RunVMPS.f90 ThisIsBS.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

C:\ISN_Forums\U507067>RunVMPS.exe
 I am alive.
 I am dead.

C:\ISN_Forums\U507067>RunVMPS.exe
 I am alive.
 I am dead.

C:\ISN_Forums\U507067>RunVMPS.exe
 I am alive.
 I am dead.

 

 

 

What are you using for compiler options?

   thanks -

                    --Lorri

Lorri and Patrick,

Thank you for responding and I'm sorry for my tardiness in my followup.

@ Patrick:  I downloaded and installed Update 2 and I am encountering the same behavior.

@ Lorri:  I am compiling the Debug configuration to the Win32 platform.  The compiler command line is:

/nologo /debug:full /Od /heap-arrays0 /I"C:\Program Files\Intel\Compiler\11.0\074\fortran\mkl\include" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c

and the link command line is:

/OUT:"Debug\vmpsI.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\Intel\Compiler\11.0\074\fortran\mkl\ia32\lib" /MANIFEST /MANIFESTFILE:"F:\UCF\Physics\PHY 4912\Projects\vmpsI\Debug\vmpsI.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\UCF\Physics\PHY 4912\Projects\vmpsI\Debug\vmpsI.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"F:\UCF\Physics\PHY 4912\Projects\vmpsI\Debug\vmpsI.lib" mkl_lapack95.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

Thank you again for your help.

Rich

Richard,

Just for testing purposes, what happens when in your program you replace

        H1Vals = TRANSPOSE(RESHAPE((/ -1.0d0, 0.0d0, 0.0d0, 1.0d0 /), (/ 2, 2 /)))
        H2Vals = TRANSPOSE(RESHAPE((/ 0.0d0, 1.0d0, 1.0d0, 0.0d0 /), (/ 2, 2 /)))
with

        H1Vals = 0.0d0
        H2Vals = 0.0d0
Essentially I am checking to see if the problem resides outside of ThisIsBS

There is nothing wrong with your original statements, the suggestion simplifies the program further.

Jim Dempsey

www.quickthreadprogramming.com

Hi Richard,

OK, I can reproduce the access violation with the 32-bit compiler.  I'll look into this more.

My initial testing was using the 64-bit version, which doesn't have the issue.

patrick

Hello Richard,

The issue with the 32-bit compiler is due to option /heap-arrays0.  Let me debug this a bit more before filing a bug report with the developers.

patrick

The exception originates in libifcoremdd.  The scope is greater than I first thought, it occurs for both the 32-bit and 64-bit compilers on both Windows and Linux.

Reported to the developers, tracking ID DPD200254462. I'll keep this thread updated with any news.

Patrick

This issue is now fixed in a future version of the compiler.  I will update this thread when a compiler with the fix is available.  The only known workaround is to not use the /heap-arrays compiler option.

Patrick

All,

I just installed Update 3, which was just published and the issue does not appear to have been resolved:

forrtl: severe (157): Program Exception - access violation
Image              PC        Routine            Line        Source
libifcoremdd.dll   003B0501  Unknown               Unknown  Unknown
libifcoremdd.dll   0036042B  Unknown               Unknown  Unknown
vmpsI.exe          01236409  _VMPS                     501  VMPS.f90
vmpsI.exe          0121CC9A  _MAIN__                    53  RunVMPS.f90
vmpsI.exe          0166EDD2  Unknown               Unknown  Unknown
vmpsI.exe          015093BF  Unknown               Unknown  Unknown
vmpsI.exe          015091EF  Unknown               Unknown  Unknown
kernel32.dll       75C3EE1C  Unknown               Unknown  Unknown
ntdll.dll          776C37EB  Unknown               Unknown  Unknown
ntdll.dll          776C37BE  Unknown               Unknown  Unknown

Please confirm!

Thank you.

Regards,

Rich Bergmann

Update 3 is not the "future version" Patrick referred to. He meant the major release planned for later this year.

Steve - Intel Developer Support

Here 'future version is the v15 compiler.  It's fixed in beta v15.0 right now.

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.024 Beta Build 20140318

$ ifort -heap-arrays RunVMPS.f90 ThisIsBS.f90 && ./a.out
 I am alive.
 I am dead.
$

Patrick

Patrick,

When is the V15 compiler scheduled for release?  Is this something that will be pushed as part of the update cycle?

Thank you.

Regards,

Rich Bergmann

It's out now. You should receive a notification about it if your support is current - I don't think Intel Software Manager will consider this an update. You can download it from the Intel Registration Center.

Steve - Intel Developer Support

The 15.0.0.108 release was released earlier this week. See the sticky note at the top of this forum index.

Hello Rich,

Intel® Parallel Studio XE 2015 (includes the v15 compilers) has been released.  Your issue remains fixed in ifort-15.0.0.108:

C:\ISN_Forums\U507067\DPD200254462>ifort /debug:full /Od /heap-arrays /warn:interfaces /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs RunVMPS.f90 ThisIsBS.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:RunVMPS.exe
-debug
-pdb:RunVMPS.pdb
-subsystem:console
-incremental:no
RunVMPS.obj
ThisIsBS.obj

C:\ISN_Forums\U507067\DPD200254462>RunVMPS.exe
 I am alive.
 I am dead.

C:\ISN_Forums\U507067\DPD200254462>

Patrick

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi