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

Access Violation caused by mixed data common block

Jeff_R_1
Beginner
1,075 Views
Porting an old CVF program I get an Access Violation apparently caused by common blocks containing both charcter and real and integer data types. Is there a compiler option to stop this error or do all the commons have to be split up? /align does not help.
0 Kudos
1 Solution
TimP
Honored Contributor III
1,075 Views
You would have a problem if the data types didn't match in various instances of common block, when the data types conflict with alignment. ifort should issue a warning when common is padded for alignment; if you didn't see matching warnings each time, that would indicate a problem.

View solution in original post

0 Kudos
4 Replies
Les_Neilson
Valued Contributor II
1,075 Views
Porting an old CVF program I get an Access Violation apparently caused by common blocks containing both charcter and real and integer data types. Is there a compiler option to stop this error or do all the commons have to be split up? /align does not help.


What makes you think the violation is caused by mixed variable types in common ?
Mixed common is/has been common in the past (pardon the pun).
It would be unusual if it were caused merely by that. You may however get a compile *warning* about misaligned common variables but that should only affect performance.

First of all you should compile with all compile and run time checks on. Access violation can be caused by a number of things - uninitialised variables, array subscript bounds exceeded, and such like.
You need to show more information - the code where the error occurs and the full error message would be a good start.

Les

0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,075 Views
You can turn on runtime checks with the /check switch .

From inside Visual Studio you can add it:

Right click on the Project => select Properties => select Fortran => add to command line window options

------

Wendy

Attaching or including files in a post

0 Kudos
TimP
Honored Contributor III
1,076 Views
You would have a problem if the data types didn't match in various instances of common block, when the data types conflict with alignment. ifort should issue a warning when common is padded for alignment; if you didn't see matching warnings each time, that would indicate a problem.
0 Kudos
Jeff_R_1
Beginner
1,075 Views
I split the mixed data common into a character common and a real & integer common and reordered the variables from largest to smallest. That did the trick. Since the split and reorder were done at the same time its hard to tell which one or both fixes cleared the access violation error. Thanks to all of you foryour help!
0 Kudos
Reply