Skip to content

Potential false positive running MISRA C 2012 Rule 10.8 #154

@kylejacksonb

Description

@kylejacksonb

It appears we might not be handling standard types correctly in the check.

#include <stdint.h>

void foo(uint32_t d1)
{
    uint32_t a = (uint8_t) (d1 >> 8);  // MISRA12_10.8 - uint8_t - The value of the expression was assigned to a wider or different essential type
}

void bar(unsigned int d1)
{
    unsigned int a = (unsigned char) (d1 >> 8);  // No 10.8 reported
}

Metadata

Metadata

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