FaultDetection-FileModeConflict

The same file shall not be open for read and write access at the same time on different streams

Required inputs: IR, StaticSemanticAnalysis

This check detects conflicting uses of file handles, being opened for reading and writing at the same time in different streams.

Possible Messages

Key

Text

Severity

Disabled

mode_conflict

Same file used for both reading and writing

None

False

possible_mode_conflict

Same file possibly used for both reading and writing

None

False

Options

modes

modes

Type: dict[str, dict[str, str | bool | dict[str, str]]]

Default:

{
   'FileHandle': {
      'Check_Write_Write': False,
      'Mode_Parameter': '1',
      'Modes': {
         'Read': 'r,rb',
         'Write': 'r+,w,a,wb,ab,w+,a+,r+b,w+b,a+b,rb+,wb+,ab+'
      },
      'Resource_Parameter': '0'
   }
}
Describes when an allocating call opens a file in read or write mode. This is a dict resource -> dict with keys "Resource_Parameter", "Check_Write_Write", and "Modes" (being a dict with key "Read" and "Write").
 

resources

resources : set[str] = {'FileHandle'}

Set of resources to be checked (selection of rules in the Resources group).