Commit Graph

5602 Commits

Author SHA1 Message Date
Dave Bartolomeo
f5e320e988 Merge from master 2019-10-25 13:24:19 -07:00
Dave Bartolomeo
56cbd0c152 C++/C#: Make AliasedUse access only non-local memory
The `AliasedUse` instruction is supposed to represent future uses of aliased memory after the function returns. Since local variables from that function are no longer allocated after the function returns, the `AliasedUse` instruction should access only the set of aliased locations that does not include locals from the current stack frame.
2019-10-25 13:10:39 -07:00
Jonas Jensen
22de0efc58 Merge pull request #2008 from dave-bartolomeo/dave/IRType2
C++: Implement language-neutral IR type system
2019-10-25 09:42:23 +02:00
Dave Bartolomeo
1223388ab6 C++: Fix test expectations 2019-10-24 13:54:21 -07:00
Geoffrey White
e48936244d CPP: Reword the query message. 2019-10-24 16:22:51 +01:00
Jonas Jensen
11da4a5328 C++: Accept test results for GVN and sign analysis 2019-10-24 15:17:16 +02:00
Dave Bartolomeo
d03a4f86e5 C++/C#: Add AliasedUse instruction to all functions
This new instruction is the dual of the existing `AliasedDefinition` instruction. Whereas that instruction defines the contents of aliased memory before the function was called, `AliasedUse` represents the potential use of all aliased memory after the function returns. This ensures that writes to aliased memory do not appear "dead", even if there are no further reads from aliased memory within the function itself.
2019-10-23 11:59:05 -07:00
Jonas Jensen
7a6ec83572 C++: No CopyValue for immediately discarded exprs
Expressions like the `e` in `e;` or `e, e2`, whose result is immediately
discarded, should not get a synthetic `CopyValue`. This removes a lot of
redundancy from the IR.

To prevent these expressions from being confused with the expressions
from which they get their result, the predicate
`getInstructionConvertedResultExpression` now suppresses results for
expressions that don't produce their own result. This should fix the
mapping between expressions and IR data-flow nodes.
2019-10-23 11:56:30 +02:00
Jonas Jensen
cbbe9b4718 Merge remote-tracking branch 'upstream/master' into ir-copy-unloaded-result
Fixed conflicts by accepting new qltest output.

Conflicts:
      cpp/ql/test/library-tests/ir/ir/raw_ir.expected
      cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected
      cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected
      cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_sanity.expected
      cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_sanity.expected
2019-10-23 08:46:39 +02:00
Ziemowit Laski
ad5aa182df [CPP-434] When analyzing overflow, discard any explicit casts.
Use the simple range analysis library to detect which
          additions may in fact overflow.
2019-10-22 15:21:30 -07:00
Robert Marsh
e8dd0227ae C++: accept test changes 2019-10-22 14:27:43 -07:00
Ziemowit Laski
06f63c5477 [CPP-434] Incremental changes to SignedOverflowCheck.cpp test suite. 2019-10-22 13:06:33 -07:00
Robert Marsh
9f0499cce9 Merge pull request #2063 from jbj/dataflow-ref-parameter
C++: Data flow through reference parameters
2019-10-22 09:40:15 -07:00
Dave Bartolomeo
63038896f4 C++: Accept test output after changes 2019-10-21 17:06:32 -07:00
Ziemowit Laski
2292518933 [CPP-434] Change query so it flags overflows that were cast to unsigned. 2019-10-21 17:04:46 -07:00
Dave Bartolomeo
2cd694756b C++: Remove mistakenly-added file 2019-10-21 15:58:38 -07:00
Dave Bartolomeo
7241c1aae6 C++/C#: More sanity checks for IRType 2019-10-21 14:22:46 -07:00
Dave Bartolomeo
71a6b5dffe C++/C#: Fix some duplicate IRType problems, and add a sanity test 2019-10-21 10:46:30 -07:00
Jonas Jensen
defe99503d Merge pull request #2113 from raulgarciamsft/users/raulga/boost
Users/raulga/boost
2019-10-20 13:14:44 +02:00
Robert Marsh
8905159de7 C++: add InitializeIndirection for pointer params 2019-10-18 11:06:09 -07:00
Robert Marsh
e57fef093b C++: accept syntax-zoo changes 2019-10-18 10:08:53 -07:00
Geoffrey White
446763d331 CPP: Fix typo. 2019-10-18 14:47:21 +01:00
Geoffrey White
411f74db70 CPP: Delete comment. 2019-10-18 14:44:38 +01:00
Jonas Jensen
dcc446660e Merge pull request #2149 from rdmarsh2/rdmarsh/cpp/ir-side-effect-primary
C++: Add getPrimaryInstruction to specific side effects
2019-10-18 10:31:01 +02:00
Ziemowit Laski
70441edacf [CPP-434] Additional test case; improve QHelp by including themes from the BadAdditionOverflowCheck QHelp. 2019-10-17 16:41:17 -07:00
Robert Marsh
b29f88450b C++: buffer read side effects on unmodeled funcs 2019-10-17 12:10:23 -07:00
Jonas Jensen
9bc7ce1fac Merge pull request #2141 from geoffw0/newtest
CPP: AV Rule 114 test cases
2019-10-17 09:28:10 +02:00
Robert Marsh
30d7238921 C++: fix missing getPrimaryInstruction 2019-10-16 17:05:37 -07:00
Robert Marsh
fffe3c2432 C++: add sanity test for side effect primaries 2019-10-16 16:53:55 -07:00
Dave Bartolomeo
6e61b1dcd0 C++: Fix up after merge from master
The one interesting piece that needed to be fixed up was the type of an `Indirect[Read|Write]SideEffect` operand/result. If the parameter type is a pointer or reference to an incomplete type, we need to set the type of the side effect memory access to `Unknown`, because we don't model incomplete types in the IR type system.

I also added minimal support for `__assume` (generated as a `NoOp`), because lack of `__assume` support got in the way of debugging the other issue above.
2019-10-16 15:55:56 -07:00
Ziemowit Laski
fb625c12ef [CPP-434] Move SignedOverflowCheck test to BadAdditionOverflowCheck directory; add additional tests. 2019-10-16 14:31:11 -07:00
Dave Bartolomeo
167d2289c4 Merge from master 2019-10-16 10:10:10 -07:00
Geoffrey White
6f96d1759f Merge pull request #2077 from jbj/cfg-enable-pr
C++: enable the QL-based CFG code
2019-10-16 14:06:22 +01:00
Geoffrey White
5f1fdd08a7 CPP: Post-2115. 2019-10-16 13:51:06 +01:00
Geoffrey White
096af3c3f3 CPP: Add test cases involving __builtin_complex. 2019-10-16 13:46:11 +01:00
Matthew Gretton-Dann
692c29d095 C++: Test fun_decl for INVALID_KEYs 2019-10-15 14:47:32 +01:00
Jonas Jensen
527ec4a9e4 Merge pull request #2122 from geoffw0/bitsign2
CPP: BitwiseSignCheck.ql fix
2019-10-14 15:47:36 +02:00
Nick Rolfe
6c83c76268 C++: add a test for __builtin_complex 2019-10-14 11:31:59 +01:00
Geoffrey White
ff8e04aa99 CPP: Fix bug. 2019-10-14 11:00:43 +01:00
Geoffrey White
62625cc454 CPP: Extend the test. 2019-10-14 10:44:04 +01:00
Ziemowit Laski
5558922b31 [CPP-434] Drop the requirement that RHS not be cast to unsigned, since overflow occurs on LHS. Adjust test case. 2019-10-11 17:01:16 -07:00
zlaski-semmle
ae0c4e449f Merge pull request #1925 from geoffw0/qldoceg10
CPP: Add syntax examples to QLDoc in Access.qll, Declaration.qll
2019-10-11 12:19:18 -07:00
Ziemowit Laski
33cd6de729 [CPP-434] Improved query and test suite. 2019-10-10 18:11:35 -07:00
Raul Garcia (MSFT)
7b0e83fead Porting Boost.org TLS queries 2019-10-10 16:05:14 -07:00
Geoffrey White
1c0fdef0a8 CPP: Add a simplified test case for ImplicitThisFieldAccess. 2019-10-10 10:04:32 +01:00
Geoffrey White
bc4363bc22 CPP: Add a test of FunctionAccess and cases for FieldAccess. 2019-10-10 10:04:31 +01:00
Geoffrey White
b10988faec CPP: Fix the query. 2019-10-10 09:15:19 +01:00
Geoffrey White
3f167a6f15 CPP: Add a test involving templates. 2019-10-10 09:15:19 +01:00
Geoffrey White
4fc73cab63 CPP: Add a test of ComparisonPrecedence.ql. 2019-10-10 09:15:19 +01:00
Ziemowit Laski
1ab965761b [CPP-434] Incorporate test from BadAdditionOverflowCheck. 2019-10-09 17:30:30 -07:00