`A12-8-6`: Compiler generated special functions are not consistently flagged

Open
#811 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
compilers

Research direction

The affected rule is tested in cpp/autosar/test/rules/A12-8-6/test.cpp, including the referenced examples; start by reading those cases and the TrivialType library. Extend handling for the additional compiler-generated special-function cases described, then run the A12-8-6 tests and confirm the intended functions are consistently flagged.

Written by the indexing model from the issue text.

Description

Difficulty-Medium false positive/false negative Impact-Medium
Affected rules
  • A12-8-6
Description

Compiler generated special functions are not always flagged by this rule, because the extractor does not always generate them.

In CodeQL CLI v2.16.6 and before, this mainly affected non-template classes. However, after the upgrade to CodeQL CLI v2.18.4, special functions are not consistently generated for template classes either.

This can be addressed by extending the TrivialType library to support additional cases where the function would be compiler generated, but where it currently isn't detected.

Example

https://github.com/github/codeql-coding-standards/blob/adcb3805ea0a36d8944f63c2d7c761a501a2b379/cpp/autosar/test/rules/A12-8-6/test.cpp#L15

https://github.com/github/codeql-coding-standards/blob/adcb3805ea0a36d8944f63c2d7c761a501a2b379/cpp/autosar/test/rules/A12-8-6/test.cpp#L124

Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.