Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Debugging wierdness ?

WSinc
New Contributor I
1,235 Views
The following routine causes a "debug assertion error" when it is called.
The problem appears to be isolated to the PRINT 101 statement, trying to print the 9x9 integer array.
The reason: When I comment that out, it runs fine.
So it appears to be a combination of the RECORD TYPE and that nested DO Loop in the print statement.
Maybe it generates bad code?
*********************************************************************************
[cpp]subroutine print_record(irec)
    implicit NONE
    include "sud004.cmn"
    integer( kind=4)irec,ii,jj
    integer (kind=1)b(9,9)
101 format(1x,a/(9I2))
102 format("forward pointers:",10i6)
103 format("backward pointers:",i6)
104 format("dead",l2)
105 format("Board hash:",i10)
106 format(1x,a,i8)
!
    print 106,"contents of record ",irec
    print 101,"board contents",((brec.b(ii,jj),jj=1,9),ii=1,9)
    print 102,brec(irec).fptr
    print 103,brec(irec).bptr
    print 104,brec(irec).dead
    print 105,brec(irec).hash
    end subroutine

!  * * * * *  contents of sud004.cmn * * * * * * * * * * 
        PARAMETER recsize=1000
	type board_rec
	  integer*4 fptr(10)
	  integer*4 bptr
	  integer*4 hash
	  integer*4 flink
	  integer*2 nomoves
	  integer*2 moveno
	  integer*1 done
	  logical*1 dead
	  integer*1 level
	  integer*1 dummy
	  integer*1 b(9,9)	  
	end type board_rec
	common/sud004/work_level,high_board,stlink,brec
	integer*4 work_level,high_board,stlink(60000)
	type(board_rec)brec(0:4194304)
    
[/cpp]
0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,235 Views
Please attach a complete test case that can be built and run.
0 Kudos
WSinc
New Contributor I
1,235 Views
Please attach a complete test case that can be built and run.
OK, this only uses 3 files.
Should be entirely self-contained.
I checked it.
0 Kudos
Steven_L_Intel1
Employee
1,235 Views
Ok - I missed that you had also provided the common declaration. This program is getting a stack overflow because the compiler decides it needs to create a large temp for something - exactly what and why I am not sure. Compiling with /heap-arrays resolves that. I'll take a closer look.
0 Kudos
Lorri_M_Intel
Employee
1,235 Views

Change the print to:

print 101,"board contents",((brec(irec).b(ii,jj),jj=1,9),ii=1,9)

The way you have it, it's trying to print all 4+ million sets of 9x9 matrices and it's overflowing memory.


- Lorri
0 Kudos
WSinc
New Contributor I
1,235 Views
Oh, so if it's trying to print over 4 million records, that might explain it -

Interestingly enough, when I took out the embedded DO LOOPS, the problem went away.
I just copied the contents of the record to a single line one row at a time, and printed that instead.
0 Kudos
gib
New Contributor II
1,235 Views
Quoting - billsincl
Oh, so if it's trying to print over 4 million records, that might explain it -

Interestingly enough, when I took out the embedded DO LOOPS, the problem went away.
I just copied the contents of the record to a single line one row at a time, and printed that instead.
Well, you don't have a record in this statement
print 101,"board contents",((brec.b(ii,jj),jj=1,9),ii=1,9)
you have a whole array of records. Presumably you did more than just take out the embedded do loops, you must have selected the record you want.
0 Kudos
Reply