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 have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

Compiler bug candidate

hweisberg
Beginner
819 Views
Now that a new revision of the CVF compiler is coming out, here is a possible bug in the old compiler.

This program:

	program AssignedGoToTest
	common /abc/ address, value
	integer*2 address, value
	value = 1
	assign 20 to address
	go to address
20	print *, value
	end
fails to warn that is is not valid to assign an address to a 16-bit variable. When it runs, it prints "64" (on my system).

This program:

	program AssignedGoToTest
	common /abc/ address, value
!DEC$ ATTRIBUTES DLLIMPORT :: /abc/
	integer*2 address, value
	value = 1
	assign 20 to address
	go to address
20	print *, value
	end
gives the following compiler error message:

f90: Fatal: There has been an internal compiler error (C0000005).
Error executing df.exe.
Hopefully this problem has already been reported, and is not present in the Intel compiler.



0 Kudos
4 Replies
Steven_L_Intel1
Employee
819 Views
Your first bug isn't a compiler bug. You made the incorrect assumption that the value stored by ASSIGN is an address. It may be, or may not be, depending on the size of the variable. It is incorrect for a program to make any assumptions about the value stored - programs which do so are broken.

I can't reproduce your second error in CVF 6.6B.

Steve
0 Kudos
hweisberg
Beginner
819 Views
I guess we have CVF 6.6, not CVF 6.6B. Is there a way to view the release notes, and get the upgrade, that does not involve FTP, which we can not access?

I'm puzzled by your comment that, "It is incorrect for a program to make any assumptions about the value stored." The compiler in fact interprets the ASSIGN statement by storing a 32-bit value starting at the address of the INTEGER*2. This overwrites the following two bytes of memory in a basically unpredictable way. The least the compiler could do is issue a warning. Or else it should use some scheme to map "statement label values" to 16-bit values. But since it doesn't do any conversion but just merrily overwrites memory, the compiler should at least issue a warning, it seems to me.
0 Kudos
Steven_L_Intel1
Employee
819 Views
There is not currently a way to get at the release notes or upgrade by http. I have to ask the HP web people to make the release notes available by FTP, and they're rather slow to respond.

At first, I thought you were mistaken about ASSIGN, but I was able to come up with a test case that showed a problem. It's hard to do so, because in many cases the compiler uses a "shadow variable" and doesn't actually store into the variable you named at all. I can't reproduce it in Intel Visual Fortran, though. It's not supposed to overwrite variables, obviously!

Steve
0 Kudos
gregscvf
Beginner
819 Views
CVF 66-66B upgrade is at:
ftp://ftp.compaq.com/pub/products/fortran/vf/CVF-66-66B.exe
Greg
0 Kudos
Reply