-
Notifications
You must be signed in to change notification settings - Fork 274
TG-58 Java new array data in symex #1425
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
Changes from all commits
6b519ad
e36d7d8
fe2efa7
465e5dc
42c079d
fc363b3
5a0343f
435958f
0dafac2
1fa64a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,9 @@ void goto_trace_stept::output( | |
case goto_trace_stept::typet::DEAD: out << "DEAD"; break; | ||
case goto_trace_stept::typet::OUTPUT: out << "OUTPUT"; break; | ||
case goto_trace_stept::typet::INPUT: out << "INPUT"; break; | ||
case goto_trace_stept::typet::ATOMIC_BEGIN: out << "ATOMC_BEGIN"; break; | ||
case goto_trace_stept::typet::ATOMIC_BEGIN: | ||
out << "ATOMIC_BEGIN"; | ||
break; | ||
case goto_trace_stept::typet::ATOMIC_END: out << "ATOMIC_END"; break; | ||
case goto_trace_stept::typet::SHARED_READ: out << "SHARED_READ"; break; | ||
case goto_trace_stept::typet::SHARED_WRITE: out << "SHARED WRITE"; break; | ||
|
@@ -91,7 +93,7 @@ void goto_trace_stept::output( | |
|
||
out << "\n"; | ||
|
||
if(pc->is_other() || pc->is_assign()) | ||
if((pc->is_other() && lhs_object.is_not_nil()) || pc->is_assign()) | ||
{ | ||
irep_idt identifier=lhs_object.get_object_name(); | ||
out << " " << from_expr(ns, identifier, lhs_object.get_original_expr()) | ||
|
@@ -386,14 +388,8 @@ void show_goto_trace( | |
break; | ||
|
||
case goto_trace_stept::typet::CONSTRAINT: | ||
UNREACHABLE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of change probably at least requires something in the commit message as to why these are now reasonable states to reach (Someone obviously thought they were unreachable before...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah of course as it now falls through |
||
break; | ||
|
||
case goto_trace_stept::typet::SHARED_READ: | ||
case goto_trace_stept::typet::SHARED_WRITE: | ||
UNREACHABLE; | ||
break; | ||
|
||
default: | ||
UNREACHABLE; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ Author: Daniel Kroening, [email protected] | |
#include <util/pointer_offset_size.h> | ||
#include <string.h> | ||
|
||
/// reads a memory address and loads it into the dest variable marks cell as | ||
/// read before written if cell has never been written | ||
/// Reads a memory address and loads it into the `dest` variable. | ||
/// Marks cell as `READ_BEFORE_WRITTEN` if cell has never been written. | ||
void interpretert::read( | ||
const mp_integer &address, | ||
mp_vectort &dest) const | ||
|
@@ -102,7 +102,12 @@ void interpretert::clear_input_flags() | |
} | ||
} | ||
|
||
/// \return Number of leaf primitive types; returns true on error | ||
/// Count the number of leaf subtypes of `ty`, a leaf type is a type that is | ||
/// not an array or a struct. For instance the count for a type such as | ||
/// `struct { (int[3])[5]; int }` would be 16 = (3 * 5 + 1). | ||
/// \param ty: a type | ||
/// \param [out] result: Number of leaf primitive types in `ty` | ||
/// \return returns true on error | ||
bool interpretert::count_type_leaves(const typet &ty, mp_integer &result) | ||
{ | ||
if(ty.id()==ID_struct) | ||
|
@@ -299,6 +304,9 @@ bool interpretert::memory_offset_to_byte_offset( | |
} | ||
} | ||
|
||
/// Evaluate an expression | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this summary adds much, consider elaborating on what evaluating an expression means |
||
/// \param expr: expression to evaluate | ||
/// \param [out] dest: vector in which the result of the evaluation is stored | ||
void interpretert::evaluate( | ||
const exprt &expr, | ||
mp_vectort &dest) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,7 @@ IREP_ID_TWO(cpp_new_array, cpp_new[]) | |
IREP_ID_TWO(cpp_delete_array, cpp_delete[]) | ||
IREP_ID_ONE(java_new) | ||
IREP_ID_ONE(java_new_array) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is java_new_array still needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously |
||
IREP_ID_ONE(java_new_array_data) | ||
IREP_ID_ONE(java_string_literal) | ||
IREP_ID_ONE(printf) | ||
IREP_ID_ONE(input) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*******************************************************************\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just realised - this still needs to be added to the Makefile as |
||
|
||
Module: Unit tests for goto_trace_stept::output | ||
|
||
Author: Diffblue Limited. All rights reserved. | ||
|
||
\*******************************************************************/ | ||
|
||
#include <testing-utils/catch.hpp> | ||
#include <goto-programs/goto_program_template.h> | ||
#include <goto-programs/goto_trace.h> | ||
#include <iostream> | ||
|
||
SCENARIO( | ||
"Output trace with nil lhs object", | ||
"[core][goto-programs][goto_trace]") | ||
{ | ||
symbol_tablet symbol_table; | ||
namespacet ns(symbol_table); | ||
goto_programt::instructionst instructions; | ||
instructions.emplace_back(goto_program_instruction_typet::OTHER); | ||
goto_trace_stept step; | ||
step.pc = instructions.begin(); | ||
step.type = goto_trace_stept::typet::ATOMIC_BEGIN; | ||
step.output(ns, std::cout); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this assertion is no longer required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already checked by
to_struct_type
on the next lineThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also line 613
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it is sometimes useful to pull the check out to allow you to document in this specific case why it must be a struct, but this is a preference.