Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixing the final compatibility issues#338

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jsinglet merged 18 commits intomainfromlcartey/final-compiler-compat-issues
Aug 15, 2023

Conversation

@lcartey
Copy link
Contributor

@lcarteylcartey commentedAug 2, 2023
edited
Loading

Description

Address the remaining compiler compatibility issues identified by our integration testing.

Summary of notable commits:

  • 3e2f72b &25bc94d - Fix stubs forstring,string.h andcstring
    • This fixes the stubs to be compatible (although not complete) with the C++ standard for those headers. Notably our tests, and therefore our stubs, assumed that C string functionality was accessible via#include <string>, and C++ string functionality was accessible via#include "string.h". All these issues have been addressed.
    • Fixes compiler compatibility issues for:A12-0-2,A27-0-2,M16-0-5,M18-0-5,DCL55-CPP,EXP62-CPP,OOP57-CPP,STR50-CPP.
  • 446ebfe &7e49686 &a1bf303- Improve smart pointer modelling
    • In practice many standard libraries use a series of smart pointer base classes. Our queries assumed that various smart pointer functions were directly declared on the smart pointer classes themselves, and made some assumptions about the type of flow we see through smart pointers. Stubs, queries and tests have been updated to correct this issue.
    • Fixes compiler compatibility issues for:A8-4-13,A18-1-4,A20-8-1,MEM56-CPP.
  • a1bf303 - Improve data flow summaries for smart pointers
    • Our compiler testing framework showed that these queries were including flow steps in-and-out of the standard library. This commit changes the dataflow to provide summaries for these steps, then excludes the flow into the library for more stable results.
    • Fixes compiler compatibility issues for:A20-8-1,MEM56-CPP.
  • 089397a - Improvestd::string::replace modelling
    • std::string on many standard libraries uses an internal typedef__const_iterator instead of the standard specifiedconst_iterator, and this was preventing us from identifying calls toreplace.
    • Fixes compiler compatibility issue for:STR51-CPP.
  • 1f9a3b4 - improve modelling ofoperator delete.
    • A15-5-1 is updated to determinenoexcept status of the definition of a function only, and the alert message is updated to provide clarity on what is reported.
    • Fixes compiler compatibility issue for:A15-5-1.
  • e70089f - remove invalid attribute from test cases.
    • Fixes compiler compatibility issue for:A18-5-5,A18-5-6.
  • eb95419 &f283a38- updatemutex stub header to better reflect real C++ libraries
    • Remove destructor formutex and provide definitions forlock_guard constructor/destructor to match gcc/clang.
    • Fixup test cases and query forPreventDeadlockByLockingInPredefinedOrder based on these changes.
    • Fixes compiler compatibility issue for:CON50-CPP.
  • 6aaf0ee - exclude unnecessary flow steps outside source location.
    • Only consider exceptions thrown in constructors written by the user.
    • Fixes compiler compatibility issue for:A15-2-2.
  • 14e4193 - accept test results for useless include query.
    • In gcc/clang the implementation of the libraries often share a common import. In this case, the declaration ofv transitively usesstd::size_t, and#include <algorithm> transitively includes the file that definesstd::size_t. To detect such cases we would need to report redundant includes e.g. includes for which useful symbols are provided, but which are made unnecessary by other imports in the file. For now we simply accept the results.
    • Fixes compiler compatibility issue for:A16-2-2.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql,.qll,.qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • A12-0-2,A27-0-2,M16-0-5,M18-0-5,DCL55-CPP,EXP62-CPP,OOP57-CPP,STR50-CPP,A8-4-13,A18-1-4,A20-8-1,MEM56-CPP,A20-8-1,STR51-CPP,A15-5-1,A18-5-5,A18-5-6,CON50-CPP,A15-2-2,A16-2-2

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format ofshared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with thestyle guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with thestyle guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

lcarteyand others added16 commitsAugust 1, 2023 21:21
This should have no impact on tests, but addresses an incompatibility withthe standard library structure.
This commit restructures the string, string.h and cstring headers to match theexpected headers and namespaces of C++ standard declarations. This addressescompatibility issues with real compilers because our test cases expected toaccess C string functionality through the "#include <string>" header include,which is not the case in practice.This commit addresses compiler compatibility issues in the following rules: * A12-0-2 * A27-0-2 * M16-0-5 * M18-0-5 * DCL55-CPP * EXP62-CPP * OOP57-CPP * STR50-CPP
clang also supports -w for disabling all options.clang/A1-1-2 was not on the list of open issues, but gcc/A1-1-2 was - I thinkthis is an error in the matrix testing.
Fix false positives identified by compiler compatibility testing on gcc/clang,which identified that shared_ptr used a hidden base class in real compilerscausing our detection of modifying function calls to fail. This has beenaddressed, with a bonus modification to more accurately represent whichpointer/reference types are captured.
reset() is sometimes declared on a base class. Similar issue to A8-4-13, so Ihave refactored the SmartPointer class to provide predicates which identifythe operations across multiple compilers.
Fix false negative issues related to the library structure of smart pointers.This commit makes the following changes: * Update `memory` stubs to move more functions to the __shared_ptr base class * Add dataflow summaries for smart pointer constructor calls and smart   pointer get calls. * Add sanitizers to prevent flow into library code for the dataflow summaries   added above.
The std::string::replace function uses an internal typedef __const_iterator inlibstdc++, instead of the const_iterator typedef.
Mark ~mutex() as deleted, as that is what we see in real libraries.Also modify lock_guard. This didn't have any affect on the test, but retainedto ensure we better reflect real compilers.
This query included some spurious edges for results that are outside thesource location. We now exclude constructors outside the source archiveto avoid these spurious edges, and make the result more stable.
Our useless include query is looking for includes where nothing from theincluded file is used by the including file. In this case, the declaration ofv transitively uses std::size_t, and `#include <algorithm>` transitivelyincludes the file that defines std::size_t. To detect such cases we would needto report redundant includes e.g. includes for which useful symbols areprovided, but which are made unnecessary by other imports in the file.For now we just exclude these expected results, as modifying the query istricky. Furthermore, the intention of the rule is actually that we checkstandard library includes against the list of symbols as per the standardlibrary, but again this is challenging.
Fix for `PreventDeadlockByLockingInPredefinedOrder`
@lcarteylcartey changed the title(DRAFT) Fixing the final compatibility issuesFixing the final compatibility issuesAug 10, 2023
@lcarteylcartey marked this pull request as ready for reviewAugust 10, 2023 22:36
@lcartey
Copy link
ContributorAuthor

/test-matrix

@lcartey
Copy link
ContributorAuthor

/test-performance

@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status!I will report even if this PR does not contain files eligible for matrix testing.

@github-actions
Copy link

🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute.

💡 If you do not hear back from me please check my status!I will report even if I fail!

@jsinglet
Copy link
Contributor

🤖 Beep Boop!qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop!qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop!gcc/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop!clang/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop!clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!

QUERY                : ConstructorErrorLeavesObjectInInvalidStateCOMPILE_PASS         : TrueRULE                 : A15-2-2TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : Exceptions2TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : SpecialFunctionMissingNoExceptSpecificationCOMPILE_PASS         : TrueRULE                 : A15-5-1TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : Exceptions2TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : SpecialFunctionExitsWithExceptionCOMPILE_PASS         : TrueRULE                 : A15-5-1TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : Exceptions2TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : PointerToAnElementOfAnArrayPassedToASmartPointerCOMPILE_PASS         : TrueRULE                 : A18-1-4TEST_PASS            : FalseSUITE                : AUTOSARPACKAGE              : PointersTEST_DIFFERENCE      : --- expected                       +++ actual                       @@ -1,18 +1,26 @@                        edges                       +| file:///usr/include/c++/9/bits/unique_ptr.h:640:7:640:7 | this | file:///usr/include/c++/9/bits/unique_ptr.h:644:9:644:11 | __p |                        | test.cpp:3:36:3:45 | new[] | test.cpp:19:27:19:44 | call to allocate_int_array |                        | test.cpp:3:36:3:45 | new[] | test.cpp:23:12:23:29 | call to allocate_int_array |                        | test.cpp:3:36:3:45 | new[] | test.cpp:27:20:27:37 | call to allocate_int_array |                       +| test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:27:12:28 | v2 |                        | test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:30:12:36 | call to release |                       +| test.cpp:12:27:12:28 | v2 | file:///usr/include/c++/9/bits/unique_ptr.h:640:7:640:7 | this |                       +| test.cpp:12:27:12:28 | v2 | test.cpp:12:30:12:36 | call to release |                        | test.cpp:27:20:27:37 | call to allocate_int_array | test.cpp:32:12:32:20 | int_array |                        nodes                       +| file:///usr/include/c++/9/bits/unique_ptr.h:640:7:640:7 | this | semmle.label | this |                       +| file:///usr/include/c++/9/bits/unique_ptr.h:644:9:644:11 | __p | semmle.label | __p |                        | test.cpp:3:36:3:45 | new[] | semmle.label | new[] |                        | test.cpp:11:29:11:41 | call to unique_ptr | semmle.label | call to unique_ptr |                       +| test.cpp:12:27:12:28 | v2 | semmle.label | v2 |                        | test.cpp:12:30:12:36 | call to release | semmle.label | call to release |                        | test.cpp:19:27:19:44 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:23:12:23:29 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:27:20:27:37 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:32:12:32:20 | int_array | semmle.label | int_array |                        subpaths                       +| test.cpp:12:27:12:28 | v2 | file:///usr/include/c++/9/bits/unique_ptr.h:640:7:640:7 | this | file:///usr/include/c++/9/bits/unique_ptr.h:644:9:644:11 | __p | test.cpp:12:30:12:36 | call to release |                        #select                        | test.cpp:12:30:12:36 | call to release | test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:30:12:36 | call to release | A pointer to an element of an array of objects flows to a smart pointer of a single object type. |                        | test.cpp:19:27:19:44 | call to allocate_int_array | test.cpp:3:36:3:45 | new[] | test.cpp:19:27:19:44 | call to allocate_int_array | A pointer to an element of an array of objects flows to a smart pointer of a single object type. |                       [1/1 comp 39.2s eval 3.1s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/autosar/test/rules/A18-1-4/PointerToAnElementOfAnArrayPassedToASmartPointer.qlref                       COMPILE_ERROR_OUTPUT : QUERY                : SharedPtrPassedToFunctionWithImproperSemanticsCOMPILE_PASS         : TrueRULE                 : A8-4-13TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : SmartPointers1TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : OperationsAssumingMemoryLayoutPerformedOnObjectsCOMPILE_PASS         : TrueRULE                 : A12-0-2TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : ExpressionsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : UnusedIncludeDirectivesCOMPILE_PASS         : TrueRULE                 : A16-2-2TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : IncludesTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : MemoryManagementFunctionInvariantsCOMPILE_PASS         : TrueRULE                 : A18-5-5TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : InvariantsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : DynamicMemoryManagementFailureModeCOMPILE_PASS         : TrueRULE                 : A18-5-6TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : AllocationsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : UnboundedFunctionsOfLibraryCstringUsedCOMPILE_PASS         : TrueRULE                 : M18-0-5TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : BannedFunctionsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : MemcpyUsedToAccessObjectRepresentationCOMPILE_PASS         : TrueRULE                 : EXP62-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : RepresentationTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : MemcmpUsedToAccessObjectRepresentationCOMPILE_PASS         : TrueRULE                 : EXP62-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : RepresentationTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : MemsetUsedToAccessObjectRepresentationCOMPILE_PASS         : TrueRULE                 : EXP62-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : RepresentationTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : PreferSpecialMemberFunctionsAndOverloadedOperatorsToCStandardLibraryFunctionsCOMPILE_PASS         : TrueRULE                 : OOP57-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : BannedFunctionsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : OperationMayNotNullTerminateCStyleStringCertCOMPILE_PASS         : TrueRULE                 : STR50-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : StringsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : BasicStringMayNotBeNullTerminatedCertCOMPILE_PASS         : TrueRULE                 : STR50-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : StringsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : OperationMayNotNullTerminateCStyleStringAutosarCOMPILE_PASS         : TrueRULE                 : A27-0-2TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : StringsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : BasicStringMayNotBeNullTerminatedAutosarCOMPILE_PASS         : TrueRULE                 : A27-0-2TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : StringsTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : DoNotDestroyAMutexWhileItIsLockedCOMPILE_PASS         : TrueRULE                 : CON50-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : ConcurrencyTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : DoNotAllowAMutexToGoOutOfScopeWhileLockedCOMPILE_PASS         : TrueRULE                 : CON50-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : ConcurrencyTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : InformationLeakageAcrossTrustBoundariesCOMPILE_PASS         : TrueRULE                 : DCL55-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : UninitializedTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : OwnedPointerValueStoredInUnrelatedSmartPointerCertCOMPILE_PASS         : TrueRULE                 : MEM56-CPPTEST_PASS            : TrueSUITE                : CERT-C++PACKAGE              : SmartPointers2TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : OwnedPointerValueStoredInUnrelatedSmartPointerAsarCOMPILE_PASS         : TrueRULE                 : A20-8-1TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : SmartPointers1TEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT : QUERY                : FunctionLikeMacroArgsContainHashTokenCOMPILE_PASS         : TrueRULE                 : M16-0-5TEST_PASS            : TrueSUITE                : AUTOSARPACKAGE              : MacrosTEST_DIFFERENCE      : COMPILE_ERROR_OUTPUT :

@jsinglet
Copy link
Contributor

🤖 Beep Boop!gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!

SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : ConstructorErrorLeavesObjectInInvalidStateRULE                 : A15-2-2PACKAGE              : Exceptions2TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : SpecialFunctionMissingNoExceptSpecificationRULE                 : A15-5-1PACKAGE              : Exceptions2TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : SpecialFunctionExitsWithExceptionRULE                 : A15-5-1PACKAGE              : Exceptions2TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : FalseCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : PointerToAnElementOfAnArrayPassedToASmartPointerRULE                 : A18-1-4PACKAGE              : PointersTEST_DIFFERENCE      : --- expected                       +++ actual                       @@ -1,18 +1,26 @@                        edges                       +| file:///usr/include/c++/8/bits/unique_ptr.h:618:7:618:7 | this | file:///usr/include/c++/8/bits/unique_ptr.h:622:9:622:11 | __p |                        | test.cpp:3:36:3:45 | new[] | test.cpp:19:27:19:44 | call to allocate_int_array |                        | test.cpp:3:36:3:45 | new[] | test.cpp:23:12:23:29 | call to allocate_int_array |                        | test.cpp:3:36:3:45 | new[] | test.cpp:27:20:27:37 | call to allocate_int_array |                       +| test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:27:12:28 | v2 |                        | test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:30:12:36 | call to release |                       +| test.cpp:12:27:12:28 | v2 | file:///usr/include/c++/8/bits/unique_ptr.h:618:7:618:7 | this |                       +| test.cpp:12:27:12:28 | v2 | test.cpp:12:30:12:36 | call to release |                        | test.cpp:27:20:27:37 | call to allocate_int_array | test.cpp:32:12:32:20 | int_array |                        nodes                       +| file:///usr/include/c++/8/bits/unique_ptr.h:618:7:618:7 | this | semmle.label | this |                       +| file:///usr/include/c++/8/bits/unique_ptr.h:622:9:622:11 | __p | semmle.label | __p |                        | test.cpp:3:36:3:45 | new[] | semmle.label | new[] |                        | test.cpp:11:29:11:41 | call to unique_ptr | semmle.label | call to unique_ptr |                       +| test.cpp:12:27:12:28 | v2 | semmle.label | v2 |                        | test.cpp:12:30:12:36 | call to release | semmle.label | call to release |                        | test.cpp:19:27:19:44 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:23:12:23:29 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:27:20:27:37 | call to allocate_int_array | semmle.label | call to allocate_int_array |                        | test.cpp:32:12:32:20 | int_array | semmle.label | int_array |                        subpaths                       +| test.cpp:12:27:12:28 | v2 | file:///usr/include/c++/8/bits/unique_ptr.h:618:7:618:7 | this | file:///usr/include/c++/8/bits/unique_ptr.h:622:9:622:11 | __p | test.cpp:12:30:12:36 | call to release |                        #select                        | test.cpp:12:30:12:36 | call to release | test.cpp:11:29:11:41 | call to unique_ptr | test.cpp:12:30:12:36 | call to release | A pointer to an element of an array of objects flows to a smart pointer of a single object type. |                        | test.cpp:19:27:19:44 | call to allocate_int_array | test.cpp:3:36:3:45 | new[] | test.cpp:19:27:19:44 | call to allocate_int_array | A pointer to an element of an array of objects flows to a smart pointer of a single object type. |                       [1/1 comp 40.4s eval 3.1s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/autosar/test/rules/A18-1-4/PointerToAnElementOfAnArrayPassedToASmartPointer.qlref                       SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : SharedPtrPassedToFunctionWithImproperSemanticsRULE                 : A8-4-13PACKAGE              : SmartPointers1TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : OperationsAssumingMemoryLayoutPerformedOnObjectsRULE                 : A12-0-2PACKAGE              : ExpressionsTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : UnusedIncludeDirectivesRULE                 : A16-2-2PACKAGE              : IncludesTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : MemoryManagementFunctionInvariantsRULE                 : A18-5-5PACKAGE              : InvariantsTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : DynamicMemoryManagementFailureModeRULE                 : A18-5-6PACKAGE              : AllocationsTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : UnboundedFunctionsOfLibraryCstringUsedRULE                 : M18-0-5PACKAGE              : BannedFunctionsTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : MemcmpUsedToAccessObjectRepresentationRULE                 : EXP62-CPPPACKAGE              : RepresentationTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : MemsetUsedToAccessObjectRepresentationRULE                 : EXP62-CPPPACKAGE              : RepresentationTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : MemcpyUsedToAccessObjectRepresentationRULE                 : EXP62-CPPPACKAGE              : RepresentationTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : PreferSpecialMemberFunctionsAndOverloadedOperatorsToCStandardLibraryFunctionsRULE                 : OOP57-CPPPACKAGE              : BannedFunctionsTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : OperationMayNotNullTerminateCStyleStringCertRULE                 : STR50-CPPPACKAGE              : StringsTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : BasicStringMayNotBeNullTerminatedCertRULE                 : STR50-CPPPACKAGE              : StringsTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : OperationMayNotNullTerminateCStyleStringAutosarRULE                 : A27-0-2PACKAGE              : StringsTEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : BasicStringMayNotBeNullTerminatedAutosarRULE                 : A27-0-2PACKAGE              : StringsTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : DoNotAllowAMutexToGoOutOfScopeWhileLockedRULE                 : CON50-CPPPACKAGE              : ConcurrencyTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : DoNotDestroyAMutexWhileItIsLockedRULE                 : CON50-CPPPACKAGE              : ConcurrencyTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : InformationLeakageAcrossTrustBoundariesRULE                 : DCL55-CPPPACKAGE              : UninitializedTEST_DIFFERENCE      : SUITE                : CERT-C++TEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : OwnedPointerValueStoredInUnrelatedSmartPointerCertRULE                 : MEM56-CPPPACKAGE              : SmartPointers2TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : OwnedPointerValueStoredInUnrelatedSmartPointerAsarRULE                 : A20-8-1PACKAGE              : SmartPointers1TEST_DIFFERENCE      : SUITE                : AUTOSARTEST_PASS            : TrueCOMPILE_ERROR_OUTPUT : COMPILE_PASS         : TrueQUERY                : FunctionLikeMacroArgsContainHashTokenRULE                 : M16-0-5PACKAGE              : MacrosTEST_DIFFERENCE      :

@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has beencompleted. If no reports were posted it means this PR does not contain things that need matrix testing!

@jsinglet
Copy link
Contributor

🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You canfind full graphs and stats in the PR that was created for this test in the release engineering repo.

Release                            : v2.20.0Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 2983369Mean_Predicate_Execution_Time_Ms   : 80.49019290435722Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 812.7769764280572Total_Serialized_Execution_Time_s  : 2983.369Mean_Query_Execution_Time_s        : 0.0804901929043572Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 183.0Number_of_Predicates               : 37065Release                            : v2.20.0Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3271097Mean_Predicate_Execution_Time_Ms   : 79.19756434157325Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 1216.7021436787627Total_Serialized_Execution_Time_s  : 3271.097Mean_Query_Execution_Time_s        : 0.0791975643415732Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 156.0Number_of_Predicates               : 41303Release                            : v2.20.0Platform                           : x86-windowsLanguage                           : cTotal_Serialized_Execution_Time_Ms : 3323606Mean_Predicate_Execution_Time_Ms   : 89.50063282617477Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 885.803234847289Total_Serialized_Execution_Time_s  : 3323.606Mean_Query_Execution_Time_s        : 0.0895006328261747Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 206.29999999999563Number_of_Predicates               : 37135Release                            : v2.20.0Platform                           : x86-windowsLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3698496Mean_Predicate_Execution_Time_Ms   : 90.41009093575828Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 1369.993033711765Total_Serialized_Execution_Time_s  : 3698.496Mean_Query_Execution_Time_s        : 0.0904100909357582Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 183.0Number_of_Predicates               : 40908Release                            : v2.21.0Platform                           : x86-windowsLanguage                           : cTotal_Serialized_Execution_Time_Ms : 3343159Mean_Predicate_Execution_Time_Ms   : 90.05384656825773Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 895.0686158000931Total_Serialized_Execution_Time_s  : 3343.159Mean_Query_Execution_Time_s        : 0.0900538465682577Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 208.0Number_of_Predicates               : 37124Release                            : v2.21.0Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 2958950Mean_Predicate_Execution_Time_Ms   : 80.16010619564923Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 793.7839873192156Total_Serialized_Execution_Time_s  : 2958.95Mean_Query_Execution_Time_s        : 0.0801601061956492Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 189.0Number_of_Predicates               : 36913Release                            : v2.21.0Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3230480Mean_Predicate_Execution_Time_Ms   : 78.4916296134315Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 1199.1949622346183Total_Serialized_Execution_Time_s  : 3230.48Mean_Query_Execution_Time_s        : 0.0784916296134315Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 160.0Number_of_Predicates               : 41157Release                            : v2.21.0Platform                           : x86-windowsLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3575250Mean_Predicate_Execution_Time_Ms   : 87.56643562173944Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 1351.655128024238Total_Serialized_Execution_Time_s  : 3575.25Mean_Query_Execution_Time_s        : 0.0875664356217394Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 175.0Number_of_Predicates               : 40829Release                            : 338Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3180125Mean_Predicate_Execution_Time_Ms   : 77.32074691823287Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 1180.0538627998292Total_Serialized_Execution_Time_s  : 3180.125Mean_Query_Execution_Time_s        : 0.0773207469182328Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 159.0Number_of_Predicates               : 41129Release                            : 338Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 2999925Mean_Predicate_Execution_Time_Ms   : 80.85615330709935Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 813.2797269837727Total_Serialized_Execution_Time_s  : 2999.925Mean_Query_Execution_Time_s        : 0.0808561533070993Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 186.0Number_of_Predicates               : 37102

🏁 Below are the slowest predicates for the last 2 releases vs this PR.

Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : PreProcessorShallOnlyBeUsedForCertainDirectivesPatterns#32e68f1c::getAGuard#1#ffExecution_Time_Ms : 30957Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameField#2#ffExecution_Time_Ms : 55357Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cppSuite             : cert-defaultPredicate         : SSAConstruction#2b11997e::DefUse::hasNonPhiDefinition#4#ffffExecution_Time_Ms : 32596Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : m##DataFlowUtil#7572fbec::localFlowStep#2Plus#bfExecution_Time_Ms : 146724Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : Dependency#b0c9183e::dependsOnTransitive#2#ffExecution_Time_Ms : 180746Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : SSAConstruction#2b11997e::DefUse::hasNonPhiDefinition#4#ffffExecution_Time_Ms : 29296Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : #select#cpe#123#fffExecution_Time_Ms : 33035Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameIndexInternal#4#ffff_3012#join_rhsExecution_Time_Ms : 34287Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameField#2#ffExecution_Time_Ms : 51452Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : _Literal#c5958f4a::ArrayOrVectorAggregateLiteral::getArraySize#0#dispred#bf_Literal#c5958f4a::ArrayO__#join_rhsExecution_Time_Ms : 65074Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-windowsLanguage          : cSuite             : cert-defaultPredicate         : SSAConstruction#2b11997e::PhiInsertion::definitionHasRedefinition#3#fffExecution_Time_Ms : 30844Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : UnusedIncludeDirectives#574b69bc::getANonLocalDependency#1#ffExecution_Time_Ms : 26110Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : PreProcessorShallOnlyBeUsedForCertainDirectivesPatterns#32e68f1c::getAGuard#1#ffExecution_Time_Ms : 30378Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : Dependency#b0c9183e::dependsOnTransitive#2#ffExecution_Time_Ms : 139733Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : m##DataFlowUtil#7572fbec::localFlowStep#2Plus#bfExecution_Time_Ms : 154688Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : #select#cpe#123#fffExecution_Time_Ms : 26663Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Contracts3#5e6bc86c::Contracts3Package::onlyTestErrnoRightAfterErrnoSettingFunctionQuery#0#f_Deviat__#antijoin_rhsExecution_Time_Ms : 31364Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameIndexInternal#4#ffff_3012#join_rhsExecution_Time_Ms : 33723Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Literal#c5958f4a::ArrayOrVectorAggregateLiteral::getArraySize#0#dispred#bf_Literal#c5958f4a::ArrayO__#join_rhsExecution_Time_Ms : 50415Release           : v2.21.0Run               : 2023-08-02_20-20-14Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : SSAConstruction#2b11997e::DefUse::hasNonPhiDefinition#4#ffffExecution_Time_Ms : 24291Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Literal#c5958f4a::ArrayOrVectorAggregateLiteral::getArraySize#0#dispred#bf_Literal#c5958f4a::ArrayO__#join_rhsExecution_Time_Ms : 51452Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameIndexInternal#4#ffff_3012#join_rhsExecution_Time_Ms : 33611Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Contracts3#5e6bc86c::Contracts3Package::onlyTestErrnoRightAfterErrnoSettingFunctionQuery#0#f_Deviat__#antijoin_rhsExecution_Time_Ms : 31472Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : #select#cpe#123#fffExecution_Time_Ms : 31457Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : UnusedIncludeDirectives#574b69bc::getANonLocalDependency#1#ffExecution_Time_Ms : 25851Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : Dependency#b0c9183e::dependsOnTransitive#2#ffExecution_Time_Ms : 137312Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : PreProcessorShallOnlyBeUsedForCertainDirectivesPatterns#32e68f1c::getAGuard#1#ffExecution_Time_Ms : 29855Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cppSuite             : cert-defaultPredicate         : SSAConstruction#2b11997e::DefUse::hasNonPhiDefinition#4#ffffExecution_Time_Ms : 25152Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : m##DataFlowUtil#7572fbec::localFlowStep#2Plus#bfExecution_Time_Ms : 151401Release           : 338Run               : 2023-08-10_23-06-50Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement#76b22bdc::hasMultipleInitializerExprsForSameField#2#ffExecution_Time_Ms : 57042

libc++ defines release inline in the header, which causes extraneous paths tobe reported by CodeQL. Adjust to summarize and exclude.
…hub/codeql-coding-standards into lcartey/final-compiler-compat-issues
@lcartey
Copy link
ContributorAuthor

No performance concerns, and I've addressed theA18-1-4 matrix testing compiler compatibility issue reported above.

@mbaludambaluda self-requested a reviewAugust 14, 2023 14:39
@jsingletjsinglet self-requested a reviewAugust 15, 2023 14:20
Copy link
Contributor

@jsingletjsinglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great Luke! Thanks for all this work getting these sorted 💪 🚀

@jsingletjsinglet added this pull request to themerge queueAug 15, 2023
Merged via the queue intomain with commita79ad24Aug 15, 2023
@jsingletjsinglet deleted the lcartey/final-compiler-compat-issues branchAugust 15, 2023 16:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mbaludambaludaAwaiting requested review from mbaluda

1 more reviewer

@jsingletjsingletjsinglet approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@lcartey@jsinglet

[8]ページ先頭

©2009-2025 Movatter.jp