Reputation: 2438
I have a warning message which is appearing very frequently in my build log. The warning message is:
Named COMMON block ‘<BLOCK_NAME>’ at (1) shall be of the same size as elsewhere ( <SIZE_1> vs <SIZE_2> bytes)
Is there a flag which will suppress this message? I have tried -Wno-align-commons
.
Note: I want to suppress the warning so I can more easily spot new warning messages. Harder to do when you have thousands.
Upvotes: 0
Views: 652
Reputation: 195
I know that the "question" is about a compiler flag and not an actual fix, but it happens that I just fixed that warning in some legacy code I'm cleaning up, so just to help someone else in the same situation.
That warning warns you that a common shared memory area has different sizes in different places of your code Like in:
REAL FUNCTION SAMPLE_TASK(VAR)
REAL S1, S2
COMMON /C1/ S1, S2
....
....
REAL FUNCTION OTHER_TASK(VAR)
REAL S1, S2
COMMON /C1/ S1
So the easiest way to fix it is just to either get rid of useless variables or add the missing ones like this.
COMMON /C1/ S1, **S1**
Hope it helps :)
Upvotes: 1
Reputation: 900
If you are compiling the source code that generates that warning, then you have access to that source code. So you can modified the source code, but you just don't want to modified it. -Wno-align-commons controls warnings about alignment issues. The warning here is about a size mismatch. Do you really want to possibly write to random memory? There is only one way to suppress that warning, and that is to use -w, which suppresses all warnings.
Upvotes: 2