Bug 575647 - Codan doesn't recognise that for (;;){} doesn't terminate
Summary: Codan doesn't recognise that for (;;){} doesn't terminate
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 10.3.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-26 08:33 EDT by David Crocker CLA
Modified: 2021-08-26 08:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Crocker CLA 2021-08-26 08:33:40 EDT
With the following code:

inline int test(int i)
{
	if (i != 0)
	{
		return i;
	}
	for (;;) { }
}

Codan reports "No return, in function returning non-void". The construct "for (;;){}" is a common idiom for a non-terminating loop.

Codan does recognise the alternative idiom "while(true){}" an non-terminating.