- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am porting a project from Windows to Linux where some F95 code is being called from C. In that code, strutures are passed by reference from C to FORTRAN, and vice-versa.
The problem comes in that the memory alignment of these structures is different on the C side (as generated by gcc 4.1.1) then on the FORTRAN side (as generated by ifort 9.1). In a subset of the project I solved this by passing "-align none" to the fortran compiler and it worked beautifully.
Now, on another subset I'm trying the same trick. But I'm getting errors such as the following for some of the structures:
The structure length is not a multiple of its largest element; could create misalignments for arrays of this type.
The structure contains one or more misaligned fields.
So ... what's going on here? It sounds like things might not go well if I proceed with the "-align none" option. I haven't exhausted my compiler options on either side to make things line up, but I'd be happy if somebody could point me in the right direction. And I could manually align them - but I really don't want to go there. There are quite a few of these errors reported.
Thanks
Eric
The problem comes in that the memory alignment of these structures is different on the C side (as generated by gcc 4.1.1) then on the FORTRAN side (as generated by ifort 9.1). In a subset of the project I solved this by passing "-align none" to the fortran compiler and it worked beautifully.
Now, on another subset I'm trying the same trick. But I'm getting errors such as the following for some of the structures:
The structure length is not a multiple of its largest element; could create misalignments for arrays of this type.
The structure contains one or more misaligned fields.
So ... what's going on here? It sounds like things might not go well if I proceed with the "-align none" option. I haven't exhausted my compiler options on either side to make things line up, but I'd be happy if somebody could point me in the right direction. And I could manually align them - but I really don't want to go there. There are quite a few of these errors reported.
Thanks
Eric
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those are just warnings. You can disable the warnings.
You should use SEQUENCE in your derived type to eliminate any padding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So these warned about misalignments won't actually break anything?MADsblionel:
Those are just warnings. You can disable the warnings.
You should use SEQUENCE in your derived type to eliminate any padding.
Ok, thanks - I'll look into that.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page