Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #12267 (Misra.py: crashes in 17.7 checker when there is macro in variable declaration) #5768

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3358,9 +3358,9 @@ def misra_17_7(self, data):
continue
if token.str != '(' or token.astParent:
continue
if not token.astOperand1 or not token.astOperand1.isName:
if token.astOperand1 is None or not token.astOperand1.isName:
continue
if token.astOperand1.varId and get_function_pointer_type(token.astOperand1.variable.typeStartToken) is None:
if token.astOperand1.varId and (token.astOperand1.variable is None or get_function_pointer_type(token.astOperand1.variable.typeStartToken) is None):
continue
if token.valueType is None:
continue
Expand Down
12 changes: 12 additions & 0 deletions addons/test/misra/crash10.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//#12267

extern uint32_t end;

//#define KEEP // if uncomment this then wont crash

KEEP static const int32_t ptr_to_end = &end;

void foo(void)
{
(void)ptr_to_end;
}
Loading