- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wish to keep this data in the same order, since I read the entire structure in in one READ statement. As far as I can tell, this should be naturally aligned, but I get a warning message every time I compile it:
type piece
sequence
character*84 descr
integer(1) nrot
logical flip
integer(1) xlim
integer(1) ylim
integer(1) rot(4)
integer(1) x(5)
integer(1) y(5)
end type piece
type(piece)pieces(12)
common/piece01/pieces
Since all of the above are of length 1 byte, I don't understand why there should be any unaligned items. But in case there are, how can I insert dummy items in the above sequence without disrupting the order of the READ statement? I had to put the SEQUENCE statement in there, otherwise it won't compile at all.
type piece
sequence
character*84 descr
integer(1) nrot
logical flip
integer(1) xlim
integer(1) ylim
integer(1) rot(4)
integer(1) x(5)
integer(1) y(5)
end type piece
type(piece)pieces(12)
common/piece01/pieces
Since all of the above are of length 1 byte, I don't understand why there should be any unaligned items. But in case there are, how can I insert dummy items in the above sequence without disrupting the order of the READ statement? I had to put the SEQUENCE statement in there, otherwise it won't compile at all.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Component flip is four bytes. You probably want logical(1) there.
You can ask the compiler to insert alignment padding in sequenced structures through the /align:sequence option, but I think fixing the declaration of flip is really the solution you want.
Steve
You can ask the compiler to insert alignment padding in sequenced structures through the /align:sequence option, but I think fixing the declaration of flip is really the solution you want.
Steve

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