Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Allocation failure for automatic array with /Qtrapuv

Andrew_Smith
Valued Contributor I
703 Views

I get a status code of 151 and the array comes back with a size but with all elements showing undefined address. Only happens if /Qtrapuv is on. Can produce heap corruption warning too with more variables allocated.

UsingVS2005 SP1,Intel Fortran 10.1.0.24, Windows XP64 SP2

program

BugTestAutomaticArray

implicit none

integer status

real*4, allocatable, automatic :: a(:)

allocate(a(10), stat = status)

a = 1.0

end

program

I don't normally use automatic but it was an experiment to see why I am getting problems with OpenMP with random results after many weeks of debugging. OpenMPsets all local variables as automatic butin this case I don't get the allocation error but I do get some strange initial values.

0 Kudos
3 Replies
Steven_L_Intel1
Employee
703 Views
This is a compiler bug, but also your bug as you should check the status before using the array. The compiler is proceeding to fill in the descriptor for the array even though the allocation failed, and you get garbage values. The bug has already been fixed for a future release.
0 Kudos
Andrew_Smith
Valued Contributor I
703 Views

Thankyoufor your quick reponse.smiley [:-)]

Have you fixed theinitial failure to allocate or just the garbage after a failure ? Hopefully the first bug.

I agea it is good practice to check the status after alloactions but this code was intended to crash, so not checking in this case helped to ensure it did!

0 Kudos
Steven_L_Intel1
Employee
703 Views
We fixed the garbage after the failure. The failure to allocate with /Qtrapuv is a new one, but I recommend against using that option anyway as it is worthless in its current implementation. However, I will report that to the developers.
0 Kudos
Reply