Skip to content

False positive running MISRA C:2023 rule 10.6 violation #159

@kylejacksonb

Description

@kylejacksonb

I've been running into another MISRA C:2023 rule violation for the following code:

typedef unsigned char      uint8_t;  
typedef unsigned short     uint16_t;
extern volatile uint8_t REG_DATA_IN;
uint8_t read( const uint16_t adr ) 
{  uint8_t io_data = REG_DATA_IN;  return io_data;}

void rgBusSetBit( const uint16_t adr, const uint8_t mask) 
{  const uint8_t var = read( adr );  write( adr, (var | mask));}

Obviously the read function returns uint8_t, but the assignment to const uint8_t var seems to violate rule 10.6.

From my point of view both should be of the same essential type and not an MISRA issue.
Could you please have a look on this?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions