Data Flow Testing. CSCE Lecture 10-02/09/2017

Size: px
Start display at page:

Download "Data Flow Testing. CSCE Lecture 10-02/09/2017"

Transcription

1 Data Flow Testing CSCE Lecture 10-02/09/2017

2 Control Flow Capture dependencies in terms of how control passes between parts of a program. We care about the effect of a statement when it affects the path taken. but deemphasize the information being transmitted. T x--; 1<x F /* continue */ Gregory Gay CSCE Spring

3 Data Flow Another view - program statements compute and transform data So, look at how that data is passed through the program. Reason about data dependence A variable is used here - where does its value from? Is this value ever used? Is this variable properly initialized? If the expression assigned to a variable is cha what else would be affected? Gregory Gay CSCE Spring

4 Data Flow Analyses Used to detect faults and other anomalies. Forward (pred) Any-Paths Reach All-Paths Avail Backward (succ) U may be preceded by G without an intervening K Live U is always preceded by G without an intervening K Inevitability D may lead to G before K D always leads to G before K Also can be used to derive test cases. Have we covered the data dependencies? Gregory Gay CSCE Spring

5 Variable Aliasing

6 Dealing With Arrays/Pointers Arrays and pointers (including object references and arguments) introduce issues. It is not possible to determine whether two access refer to the same storage location. a[x] = 13; k = a[y]; Are these a def-use pair? a[2] = 42; i = b[2]; Are these a def-use pair? Aliasing = two names refer to the same memory location. Gregory Gay CSCE Spring

7 Aliasing Aliasing is when two names refer to the same memory location. int[] a = new int[3]; int[] b = a; a[2] = 42; i = b[2]; a and b are aliases. Worse in C: p = &b; *(p + i) = k; Gregory Gay CSCE Spring

8 Uncertainty Dynamic references and aliasing introduce uncertainty into data flow analysis. Instead of a definition or use of one variable, may have a potential def or use of a set of variables. Proper treatment depends on purpose of analysis: If we examine variable initialization, might not want to treat assignment to a potential alias as initialization. May wish to treat a use of a potential alias of v as a use of v. Gregory Gay CSCE Spring

9 Dealing With Uncertainty Basic option: Treat all potential aliases as definitions and uses of the same variable: a[1] = 13; k = a[2]; Def of a[1], use of a[2]. a[x] = 13; k = a[y]; Def and use of array a. Easiest and cheapest option when performing an analysis. Can be very imprecise. They are only the same if x and y are the same. Gregory Gay CSCE Spring

10 Dealing With Uncertainty Treat uncertainty about aliases like uncertainty about control flow. a[x] = 13; k = a[y]; a[x] = 13; if(x == y) else k = a[x]; k = a[y]; In transformed code, all array references are distinct. Any-path analysis - create a def-use pair, but assignment to a[y] does not erase definition to a[x]. Gen sets include everything that might be references, kill sets only include definite references. Gregory Gay CSCE Spring

11 Dealing With Uncertainty a[x] = 13; k = a[y]; a[x] = 13; if(x == y) else k = a[x]; k = a[y]; In transformed code, all array references are distinct. Any-path analysis - create a def-use pair, but assignment to a[y] does not erase definition to a[x]. All-paths analysis - a definition to a[x] makes only that expression available. Assignment to a[y] kills a[x]. Gen sets should include only what is definitely referenced and kill sets should include all possible aliases. Gregory Gay CSCE Spring

12 Dealing With Nonlocal Information fromcust and tocust may be references to the same object. from/tohome and from/towork may also reference the same object. Common option - treat all nonlocal information as unknown. Treat Customer/PhoneNum objects as potential aliases. Be careful - may result in results so imprecise they are useless. public void transfer(customer fromcust, Customer tocust){ } PhoneNum fromhome = fromcust.gethomephone(); PhoneNum fromwork = fromcust.getworkphone(); PhoneNum tohome = tocust.gethomephone(); PhoneNum towork = tocust.getworkphone(); Gregory Gay CSCE Spring

13 Interprocedural Analysis

14 Interprocedural Analysis - Control Flow First option - include other procedures in a Problem - infeasible paths! large CFG foo() sub() bar() A X C sub() Y sub() B D Gregory Gay CSCE Spring

15 Context-Sensitivity public class Context{ public static void main(string args[]){ Context c = new Context(); c.foo(3); c.bar(17); } void foo(int n){ int[] a = new int[n]; depends(a,2); } void bar(int n){ int[] a = new int[n]; depends(a,16); } void depends(int[] a, int n){ a[n] = 42; } } main main C.foo() C.foo(3) C.bar() C.bar(17) C.depends C.depends() C.depends (int[3], a, 2) (int[17], a, 16) Context-Insensitive Context-Sensitive Gregory Gay CSCE Spring

16 Context-Sensitive Analysis Copy the called procedure for each point that it is called. Problem - the number of contexts a procedure is called in is exponentially higher than the number of procedures. Precise, but expensive analysis. In practice, only feasible for small groups of related procedures. B D F H A C E G Gregory Gay CSCE Spring

17 Context-Insensitive Analysis Unhandled exception analysis If procedure A calls procedure B that throws an exception, A must handle or declare that exception. Analysis steps hierarchically through the call graph. Two conditions: Information needed to analyze calling procedure must be small. Information about the called procedure must be independent of caller (context-insensitive) Analysis can start from leaves of call graph and work upward to the root. Gregory Gay CSCE Spring

18 Flow-Sensitivity Aliasing information requires context. Some analyses can sacrifice precision on another aspect: control-flow information Call graphs are flow-insensitive. C.foo(3) C.depends (int[3], a, 2) main C.bar(17) C.depends (int[17], a, 16) Gregory Gay CSCE Spring

19 Insensitive Pointer Analysis Treat each statement as a constraint. x = y; (where y is a pointer) Note that x may refer to any of the same objects that y refers to. References(x) References(y) is a constraint independent of the path taken. Procedure calls are assignments of values to arguments. Results are imprecise, but better than just assuming that any two pointers might refer to the same object. Gregory Gay CSCE Spring

20 Data Flow Testing

21 Overcoming Limitations of Path Coverage We can potentially expose many faults by targeting particular paths of execution. Full path coverage is impossible. What are the important paths to cover? Some methods impose heuristic limitations. Loop boundary coverage Can also use data flow information to select a subset of paths based on how one element can affect the computation of another. Gregory Gay CSCE Spring

22 Choosing the Paths Branch or MC/DC coverage already cover many paths. What are the remaining paths that are important to cover? Basis of data flow testing - computing the wrong value leads to a failure only when that value is used. Pair definitions with usages. Ensure that definitions are actually used. Select a path where a fault is more likely to propagate to an observable failure. Gregory Gay CSCE Spring

23 Review - Def-Use Pairs Incorrect computation of x at either 1 or 4 could be revealed if used at 6. (1,6) and (4,6) are DU pairs for x. DU Pair = there exists a definition-clear path between the definition of x and a use of x. If x is redefined on the path, the original definition is killed and replaced. 1 x =.. if y = x +...; 6 x =... 4 Gregory Gay CSCE Spring

24 Def-Use Pairs ++counter, counter++, counter+=1 counter = counter + 1 These are equivalent. They are a use of counter, then a new definition of counter. char *ptr = *otherptr ptr++ Need a policy for how you deal with aliasing. Ad-hoc option: Definition of string *ptr Use of index ptr, string *otherptr, and index otherptr. Use of index ptr, and a definition of both the index and string *ptr. Change to index moves the pointer to a new location. Gregory Gay CSCE Spring

25 All DU Pair Coverage Requires each DU pair be exercised in at least one program execution. Erroneous values produced by one statement might be revealed if used in another statement. Coverage = number exercised DU pairs number of DU pairs Can easily achieve structural coverage without covering all DU pairs. Gregory Gay CSCE Spring

26 All DU Paths Coverage One DU pair might belong to many execution paths. Cover all simple (non-looping) paths at least once. Can reveal faults where a path is exercised that should use a certain definition but doesn t. Coverage = number of exercised DU paths number of DU paths Gregory Gay CSCE Spring

27 Path Explosion Problem Even without looping paths, the number of SU paths can be exponential to the size of the program. When code between definition and use is irrelevant to that variable, but contains many control paths. void countbits(char ch){ int count = 0; if (ch & 1) if (ch & 2) if (ch & 4) if (ch & 8) if (ch & 16) if (ch & 32) if (ch & 64) ++count; ++count; ++count; ++count; ++count; ++count; ++count; if (ch & 128) ++count; printf( %c (0X%02X) has %d bits set to 1\n, ch, ch, count); } Gregory Gay CSCE Spring

28 All Definitions Coverage All DU Pairs/All DU Paths are powerful and often practical, but may be too expensive in some situations. In those cases, pair each definition with at least one use. Coverage = number of covered definitions number of definitions Gregory Gay CSCE Spring

29 Dealing With Aliasing Requires trade-off between precision and computational efficiency. Underestimate potential aliases Could miss def-use pairs Overestimate potential aliases Could have infeasible pairs, leading to unsatis coverage obligations What is a suitable approximation of potential aliases for testing? Gregory Gay CSCE Spring

30 Infeasibility Problem Metrics may ask for impossible test cases. Path-based metrics aggravates the problem by requiring infeasible combinations of feasible elements. Alias analysis may add additional infeasible paths. All Definitions Coverage and All DU-Pairs Coverage often reasonable. All DU-Paths is much harder to fulfill. Gregory Gay CSCE Spring

31 Activity - DU Pairs Identify all DU pairs and write test cases to achieve All DU Pair Coverage. Hint - remember that there is a loop. 1. int dosomething(int x, int y) 2. { 3. while(y > 0) { 4. if(x > 0) { 5. y = y - x; 6. }else { 7. x = x + 1; 8. } 9. } 10. return x + y; 11. } Gregory Gay CSCE Spring

32 Activity - DU Pairs 1. int dosomething(int x, int y) 2. { 3. while(y > 0) { 4. if(x > 0) { 5. y = y - x; 6. }else { 7. x = x + 1; 8. } 9. } 10. return x + y; 11. } Variable Defs Uses x 1, 7 4, 5, 7, 10 y 1, 5 3, 5, 10 Variable D-U Pairs x (1, 4), (1, 5), (1, 7), (1, 10), (7, 4), (7, 5), (7, 7), (7, 10) y (1, 3), (1, 5), (1, 10), (5, 3), (5, 5), (5, 10) Gregory Gay CSCE Spring

33 Activity - DU Pairs 1. int dosomething(int x, int y) 2. { 3. while(y > 0) { 4. if(x > 0) { 5. y = y - x; 6. }else { 7. x = x + 1; 8. } 9. } 10. return x + y; 11. } Variable D-U Pairs x (1, 4), (1, 5), (1, 7), (1, 10), (7, 4), (7, 5), (7, 7), (7, 10) y (1, 3), (1, 5), (1, 10), (5, 3), (5, 5), (5, 10) Test 1: (x = 1, y = 2) Covers lines 1, 3, 4, 5, 3, 4, 5, 3, 10 Test 2: (x = -1, y = 1) Covers lines 1, 3, 4, 6, 7, 3, 4, 6, 7, 3, 4, 5, 3, 10 Test 3: (x = 1, y = 0) Covers lines 1, 3, 8 Gregory Gay CSCE Spring

34 We Have Learned Arrays, pointers, and complex data structures introduce uncertainty into analysis. Requires a policy for how aliasing is handled. Trade-off between computational feasibility and precision. Analyses must handle non-local references. Similar trade-off. Can gain efficiency by sacrificing flow sensitivity and context sensitivity. Gregory Gay CSCE Spring

35 We Have Learned If there is a fault in a computation, we can observe it by looking at where the computation is used. By identifying DU pairs and paths, we can create tests that trigger faults along those paths. All DU Pairs coverage All DU Paths coverage All Definitions coverage Gregory Gay CSCE Spring

36 Next Class Model-Based Testing Reading: Chapter 14 Homework: Homework 2 is out - Due February 23 Reading Assignment 2 due tonight Gregory Gay CSCE Spring

Data Flow Analysis. CSCE Lecture 9-02/15/2018

Data Flow Analysis. CSCE Lecture 9-02/15/2018 Data Flow Analysis CSCE 747 - Lecture 9-02/15/2018 Data Flow Another view - program statements compute and transform data So, look at how that data is passed through the program. Reason about data dependence

More information

Dependence and Data Flow Models

Dependence and Data Flow Models Chapter 6 Dependence and Data Flow Models The control flow graph and state machine models introduced in the previous chapter capture one aspect of the dependencies among parts of a program. They explicitly

More information

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Dependence and Data Flow Models (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Why Data Flow Models? Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We

More information

Why Data Flow Models? Dependence and Data Flow Models. Learning objectives. Def-Use Pairs (1) Models from Chapter 5 emphasized control

Why Data Flow Models? Dependence and Data Flow Models. Learning objectives. Def-Use Pairs (1) Models from Chapter 5 emphasized control Why Data Flow Models? Dependence and Data Flow Models Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We also need to reason about dependence Where does this

More information

More Dataflow Analysis

More Dataflow Analysis More Dataflow Analysis Steps to building analysis Step 1: Choose lattice Step 2: Choose direction of dataflow (forward or backward) Step 3: Create transfer function Step 4: Choose confluence operator (i.e.,

More information

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Dependence and Data Flow Models (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Why Data Flow Models? Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We

More information

Calvin Lin The University of Texas at Austin

Calvin Lin The University of Texas at Austin Interprocedural Analysis Last time Introduction to alias analysis Today Interprocedural analysis March 4, 2015 Interprocedural Analysis 1 Motivation Procedural abstraction Cornerstone of programming Introduces

More information

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers Interprocedural Analysis Motivation Last time Introduction to alias analysis Today Interprocedural analysis Procedural abstraction Cornerstone of programming Introduces barriers to analysis Example x =

More information

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M.

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M. F. Tip and M. Weintraub STRUCTURAL TESTING AKA White Box Testing Thanks go to Andreas Zeller for allowing incorporation of his materials STRUCTURAL TESTING Testing based on the structure of the code Test

More information

CSCE 747 Assignment 2: Structural and Data Flow Testing

CSCE 747 Assignment 2: Structural and Data Flow Testing CSCE 747 Assignment 2: Structural and Data Flow Testing Due Date: Tuesday, February 23rd, 11:59 PM There are 5 questions, worth a total of 100 points. You may discuss these problems in your teams and turn

More information

Program Analysis. CSCE Lecture 16-03/03/2016

Program Analysis. CSCE Lecture 16-03/03/2016 Program Analysis CSCE 747 - Lecture 16-03/03/2016 Axiom of Testing Program testing can be used to show the presence of bugs, but never their absence. - Dijkstra Gregory Gay CSCE 747 - Spring 2016 2 Holy

More information

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M.

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M. F. Tip and M. Weintraub STRUCTURAL TESTING AKA White Box Testing Thanks go to Andreas Zeller for allowing incorporation of his materials STRUCTURAL TESTING Testing based on the structure of the code Test

More information

Advanced C Programming

Advanced C Programming Advanced C Programming Compilers Sebastian Hack hack@cs.uni-sb.de Christoph Weidenbach weidenbach@mpi-inf.mpg.de 20.01.2009 saarland university computer science 1 Contents Overview Optimizations Program

More information

CSE 501 Midterm Exam: Sketch of Some Plausible Solutions Winter 1997

CSE 501 Midterm Exam: Sketch of Some Plausible Solutions Winter 1997 1) [10 pts] On homework 1, I asked about dead assignment elimination and gave the following sample solution: 8. Give an algorithm for dead assignment elimination that exploits def/use chains to work faster

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology Interprocedural Analysis Course so far: Control Flow Representation Dataflow Representation SSA form Classic DefUse and UseDef Chains Optimizations Scheduling Register Allocation Just-In-Time Compilation

More information

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing

More information

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Alias Analysis Last time Interprocedural analysis Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Aliasing What is aliasing? When two expressions denote the same mutable

More information

Other criteria focus on single elements.

Other criteria focus on single elements. Path Coverage Other criteria focus on single elements. However, all tests execute a sequence of elements - a path through the program. Combination of elements matters - interaction sequences are the root

More information

Finite Models. Learning objectives

Finite Models. Learning objectives Finite Models 資科系 林偉川 1 Learning objectives Understand goals and implications of finite state abstraction Learn how to model program control flow with graphs Learn how to model the software system structure

More information

Subject Software Testing Structural Testing

Subject Software Testing Structural Testing Subject Software Testing Structural Testing Objective: 1. Understand Concept of structural testing 2. How structural (code-based or glass-box) testing complements functional (black-box) testing 3. Recognize

More information

Lecture Compiler Middle-End

Lecture Compiler Middle-End Lecture 16-18 18 Compiler Middle-End Jianwen Zhu Electrical and Computer Engineering University of Toronto Jianwen Zhu 2009 - P. 1 What We Have Done A lot! Compiler Frontend Defining language Generating

More information

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM Flow Analysis Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM Helpful Reading: Sections 1.1-1.5, 2.1 Data-flow analysis (DFA) A framework for statically proving facts about program

More information

Program Static Analysis. Overview

Program Static Analysis. Overview Program Static Analysis Overview Program static analysis Abstract interpretation Data flow analysis Intra-procedural Inter-procedural 2 1 What is static analysis? The analysis to understand computer software

More information

SPIM Procedure Calls

SPIM Procedure Calls SPIM Procedure Calls 22C:60 Jonathan Hall March 29, 2008 1 Motivation We would like to create procedures that are easy to use and easy to read. To this end we will discuss standard conventions as it relates

More information

Static Analysis and Dataflow Analysis

Static Analysis and Dataflow Analysis Static Analysis and Dataflow Analysis Static Analysis Static analyses consider all possible behaviors of a program without running it. 2 Static Analysis Static analyses consider all possible behaviors

More information

Principles of Testing and Analysis. COMP 4004 Fall Notes Adapted from Dr. A. Williams

Principles of Testing and Analysis. COMP 4004 Fall Notes Adapted from Dr. A. Williams Principles of Testing and Analysis COMP 4004 Fall 2008 Notes Adapted from Dr. A. Williams Software Quality Assurance Lec 3 1 Principles of Testing and Analysis Sensitivity Redundancy Restriction Partition

More information

CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING

CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING 1 CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING Outline 2 Quiz Black-Box Testing Equivalence Class Testing (Equivalence Partitioning) Boundary value analysis Decision Table Testing 1 3 Quiz - 1

More information

Context-Sensitive Pointer Analysis. Recall Context Sensitivity. Partial Transfer Functions [Wilson et. al. 95] Emami 1994

Context-Sensitive Pointer Analysis. Recall Context Sensitivity. Partial Transfer Functions [Wilson et. al. 95] Emami 1994 Context-Sensitive Pointer Analysis Last time Flow-insensitive pointer analysis Today Context-sensitive pointer analysis Emami invocation graphs Partial Transfer Functions The big picture Recall Context

More information

Conditioned Slicing. David Jong-hoon An. May 23, Abstract

Conditioned Slicing. David Jong-hoon An. May 23, Abstract Conditioned Slicing David Jong-hoon An May 23, 2007 Abstract Program debugging is often a tedious and difficult process that requires programmers to inspect complicated code to understand and analyze the

More information

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers These notes are not yet complete. 1 Interprocedural analysis Some analyses are not sufficiently

More information

1 Black Box Test Data Generation Techniques

1 Black Box Test Data Generation Techniques 1 Black Box Test Data Generation Techniques 1.1 Equivalence Partitioning Introduction Equivalence partitioning is based on the premise that the inputs and outputs of a component can be partitioned into

More information

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts Compiler Structure Source Code Abstract Syntax Tree Control Flow Graph Object Code CMSC 631 Program Analysis and Understanding Fall 2003 Data Flow Analysis Source code parsed to produce AST AST transformed

More information

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Software Design Fundamentals. CSCE Lecture 11-09/27/2016 Software Design Fundamentals CSCE 740 - Lecture 11-09/27/2016 Today s Goals Define design Introduce the design process Overview of design criteria What results in a good design? Gregory Gay CSCE 740 -

More information

Data Flow Analysis. Program Analysis

Data Flow Analysis. Program Analysis Program Analysis https://www.cse.iitb.ac.in/~karkare/cs618/ Data Flow Analysis Amey Karkare Dept of Computer Science and Engg IIT Kanpur Visiting IIT Bombay karkare@cse.iitk.ac.in karkare@cse.iitb.ac.in

More information

Verification and Validation

Verification and Validation Verification and Validation Assuring that a software system meets a user's needs Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 19 Slide 1 Objectives To introduce software verification

More information

Programming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions.1

Programming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions.1 Programming Languages and Compilers Qualifying Examination Monday, September 19, 2016 Answer 4 of 6 questions.1 GENERAL INSTRUCTIONS 1. Answer each question in a separate book. 2. Indicate on the cover

More information

Lecture 8: Pointer Arithmetic (review) Endianness Functions and pointers

Lecture 8: Pointer Arithmetic (review) Endianness Functions and pointers CSE 30: Computer Organization and Systems Programming Lecture 8: Pointer Arithmetic (review) Endianness Functions and pointers Diba Mirza University of California, San Diego 1 Q: Which of the assignment

More information

Developing Requirements-Based Tests. CSCE Lecture 8-09/13/2016

Developing Requirements-Based Tests. CSCE Lecture 8-09/13/2016 Developing Requirements-Based Tests CSCE 740 - Lecture 8-09/13/2016 Partitioning Requirement Specification? Test Cases Functional testing is based on the idea of partitioning. You can t actually test individual

More information

Testing, code coverage and static analysis. COSC345 Software Engineering

Testing, code coverage and static analysis. COSC345 Software Engineering Testing, code coverage and static analysis COSC345 Software Engineering Outline Various testing processes ad hoc / formal / automatic Unit tests and test driven development Code coverage metrics Integration

More information

Developing Requirements- Based Tests. CSCE Lecture 8-09/21/2015

Developing Requirements- Based Tests. CSCE Lecture 8-09/21/2015 Developing Requirements- Based Tests CSCE 740 - Lecture 8-09/21/2015 Creating Requirements-Based Tests Write Testable Specifications Produce clear, detailed, and testable requirements. Identify Independently

More information

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference

More information

Structural Testing. Testing Tactics. Why Structural? Structural white box. Functional black box. Structural white box. Functional black box

Structural Testing. Testing Tactics. Why Structural? Structural white box. Functional black box. Structural white box. Functional black box From Pressman, Software Engineering a practitioner s approach, Chapter 14 and Pezze + Young, Software Testing and Analysis, Chapters 12-13 Structural Testing Software Engineering Andreas Zeller Saarland

More information

Finite State Verification. CSCE Lecture 14-02/25/2016

Finite State Verification. CSCE Lecture 14-02/25/2016 Finite State Verification CSCE 747 - Lecture 14-02/25/2016 So, You Want to Perform Verification... You have a property that you want your program to obey. Great! Let s write some tests! Does testing guarantee

More information

Agenda. Peer Instruction Question 1. Peer Instruction Answer 1. Peer Instruction Question 2 6/22/2011

Agenda. Peer Instruction Question 1. Peer Instruction Answer 1. Peer Instruction Question 2 6/22/2011 CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduction to C (Part II) Instructors: Randy H. Katz David A. Patterson http://inst.eecs.berkeley.edu/~cs61c/sp11 Spring 2011 -- Lecture

More information

Goals of this Lecture

Goals of this Lecture C Pointers Goals of this Lecture Help you learn about: Pointers and application Pointer variables Operators & relation to arrays 2 Pointer Variables The first step in understanding pointers is visualizing

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

Software Testing. 1. Testing is the process of demonstrating that errors are not present.

Software Testing. 1. Testing is the process of demonstrating that errors are not present. What is Testing? Software Testing Many people understand many definitions of testing :. Testing is the process of demonstrating that errors are not present.. The purpose of testing is to show that a program

More information

Homework Assignment #1 Sample Solutions

Homework Assignment #1 Sample Solutions Homework Assignment # Sample Solutions Due Monday /, at the start of lecture. For the following control flow graph, for the purposes of a forward data flow analysis (such as available expressions), show

More information

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file? QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The

More information

Using the code to measure test adequacy (and derive test cases) Structural Testing

Using the code to measure test adequacy (and derive test cases) Structural Testing Using the code to measure test adequacy (and derive test cases) Structural Testing Objectives To describe a second approach to testing which is geared to find program defects To explain the use of program

More information

QUIZ Friends class Y;

QUIZ Friends class Y; QUIZ Friends class Y; Is a forward declaration neeed here? QUIZ Friends QUIZ Friends - CONCLUSION Forward (a.k.a. incomplete) declarations are needed only when we declare member functions as friends. They

More information

Informed Search Methods

Informed Search Methods Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in as the crow flies distance to goal 8-puzzle: Heuristic: Expand

More information

1.00 Lecture 4. Promotion

1.00 Lecture 4. Promotion 1.00 Lecture 4 Data Types, Operators Reading for next time: Big Java: sections 6.1-6.4 Promotion increasing capacity Data Type Allowed Promotions double None float double long float,double int long,float,double

More information

OOPLs - call graph construction. Example executed calls

OOPLs - call graph construction. Example executed calls OOPLs - call graph construction Compile-time analysis of reference variables and fields Problem: how to resolve virtual function calls? Need to determine to which objects (or types of objects) a reference

More information

Advanced Compiler Construction

Advanced Compiler Construction CS 526 Advanced Compiler Construction http://misailo.cs.illinois.edu/courses/cs526 INTERPROCEDURAL ANALYSIS The slides adapted from Vikram Adve So Far Control Flow Analysis Data Flow Analysis Dependence

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 03: White-Box Testing (Textbook Ch. 5) Dietmar Pfahl Spring 2016 email: dietmar.pfahl@ut.ee Lecture Chapter 5 White-box testing techniques (Lab 3) Structure of Lecture

More information

GCC Internals Alias analysis

GCC Internals Alias analysis GCC Internals Alias analysis Diego Novillo dnovillo@google.com November 2007 Overview GIMPLE represents alias information explicitly Alias analysis is just another pass Artificial symbols represent memory

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 4 C Pointers 2004-09-08 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Cal flies over Air Force We re ranked 13 th in the US and

More information

CSE 401 Final Exam. March 14, 2017 Happy π Day! (3/14) This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,...

CSE 401 Final Exam. March 14, 2017 Happy π Day! (3/14) This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,... CSE 401 Final Exam March 14, 2017 Happy π Day! (3/14) Name This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,.... Please wait to turn the page until everyone has their

More information

Path Testing + Coverage. Chapter 8

Path Testing + Coverage. Chapter 8 Path Testing + Coverage Chapter 8 Structural Testing n Also known as glass/white/open box testing n A software testing technique whereby explicit knowledge of the internal workings of the item being tested

More information

Test Oracles and Mutation Testing. CSCE Lecture 23-11/18/2015

Test Oracles and Mutation Testing. CSCE Lecture 23-11/18/2015 Test Oracles and Mutation Testing CSCE 740 - Lecture 23-11/18/2015 Software Testing - Back to the Basics Tests are sequences of stimuli and observations. We care about input and output. (I 1 O 1 ) (I 2

More information

CMPSCI 521/621 Homework 2 Solutions

CMPSCI 521/621 Homework 2 Solutions CMPSCI 521/621 Homework 2 Solutions Problem 1 Direct data dependencies: 3 is directly data dependent on 1 and 5 5 is directly data dependent on 1,3, and 5 7 is directly data dependent on 1,3, and 5 Note,

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering Reasoning about Programs - Selected Features Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel,

More information

Introduction. Easy to get started, based on description of the inputs

Introduction. Easy to get started, based on description of the inputs Introduction Testing is about choosing elements from input domain. The input domain of a program consists of all possible inputs that could be taken by the program. Easy to get started, based on description

More information

Final CSE 131B Spring 2004

Final CSE 131B Spring 2004 Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)

More information

Software Testing and Analysis Process, Principles, and Techniques

Software Testing and Analysis Process, Principles, and Techniques Summary Software Testing and Analysis Process, Principles, and Techniques JUNBEOM YOO Dependable Software Laboratory KONKUK University http://dslab.konkuk.ac.kr Ver. 1.0 (2012.11) This lecture note is

More information

Probabilistic Slicing for Predictive Impact Analysis

Probabilistic Slicing for Predictive Impact Analysis Probabilistic Slicing for Predictive Impact Analysis Raul Santelices and Mary Jean Harrold College of Computing, Georgia Institute of Technology E-mail: {raul harrold}@cc.gatech.edu ABSTRACT Program slicing

More information

HW1 due Monday by 9:30am Assignment online, submission details to come

HW1 due Monday by 9:30am Assignment online, submission details to come inst.eecs.berkeley.edu/~cs61c CS61CL : Machine Structures Lecture #2 - C Pointers and Arrays Administrivia Buggy Start Lab schedule, lab machines, HW0 due tomorrow in lab 2009-06-24 HW1 due Monday by 9:30am

More information

Chapter 9. Software Testing

Chapter 9. Software Testing Chapter 9. Software Testing Table of Contents Objectives... 1 Introduction to software testing... 1 The testers... 2 The developers... 2 An independent testing team... 2 The customer... 2 Principles of

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

CS2351 Data Structures. Lecture 7: A Brief Review of Pointers in C

CS2351 Data Structures. Lecture 7: A Brief Review of Pointers in C CS2351 Data Structures Lecture 7: A Brief Review of Pointers in C 1 About this lecture Pointer is a useful object that allows us to access different places in our memory We will review the basic use of

More information

DECLARAING AND INITIALIZING POINTERS

DECLARAING AND INITIALIZING POINTERS DECLARAING AND INITIALIZING POINTERS Passing arguments Call by Address Introduction to Pointers Within the computer s memory, every stored data item occupies one or more contiguous memory cells (i.e.,

More information

Software Verification and Validation. Prof. Lionel Briand Ph.D., IEEE Fellow

Software Verification and Validation. Prof. Lionel Briand Ph.D., IEEE Fellow Software Verification and Validation Prof. Lionel Briand Ph.D., IEEE Fellow 1 White-Box Testing 2 White-Box vs. Black-BoxTesting: Reminder Software Representation (Model) Associated Criteria Test cases

More information

MSc Software Testing MSc Prófun hugbúnaðar

MSc Software Testing MSc Prófun hugbúnaðar MSc Software Testing MSc Prófun hugbúnaðar Fyrirlestrar 7 & 8 Structural Testing White-box tests. 29/8/27 Dr Andy Brooks 1 Case Study Dæmisaga Reference Structural Testing of Programs, A Survey, A A Omar

More information

Data Flow Analysis. Agenda CS738: Advanced Compiler Optimizations. 3-address Code Format. Assumptions

Data Flow Analysis. Agenda CS738: Advanced Compiler Optimizations. 3-address Code Format. Assumptions Agenda CS738: Advanced Compiler Optimizations Data Flow Analysis Amey Karkare karkare@cse.iitk.ac.in http://www.cse.iitk.ac.in/~karkare/cs738 Department of CSE, IIT Kanpur Static analysis and compile-time

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 11

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 11 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 11 EXCEPTION HANDLING Many higher-level languages provide exception handling Concept: One part of the program knows how to detect a problem,

More information

CSE 331 Software Design & Implementation

CSE 331 Software Design & Implementation CSE 331 Software Design & Implementation Hal Perkins Spring 2017 Exceptions and Assertions 1 Outline General concepts about dealing with errors and failures Assertions: what, why, how For things you believe

More information

Wednesday, October 15, 14. Functions

Wednesday, October 15, 14. Functions Functions Terms void foo() { int a, b;... bar(a, b); void bar(int x, int y) {... foo is the caller bar is the callee a, b are the actual parameters to bar x, y are the formal parameters of bar Shorthand:

More information

CO444H. Ben Livshits. Datalog Pointer analysis

CO444H. Ben Livshits. Datalog Pointer analysis CO444H Ben Livshits Datalog Pointer analysis 1 Call Graphs Class analysis: Given a reference variable x, what are the classes of the objects that x refers to at runtime? We saw CHA and RTA Deal with polymorphic/virtual

More information

Dataflow-based Coverage Criteria

Dataflow-based Coverage Criteria Dataflow-based Coverage Criteria W. Eric Wong Department of Computer Science The University of Texas at Dallas ewong@utdallas.edu http://www.utdallas.edu/~ewong Dataflow-based Coverage Criteria ( 2012

More information

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer. The Compiler So Far CSC 4181 Compiler Construction Scanner - Lexical analysis Detects inputs with illegal tokens e.g.: main 5 (); Parser - Syntactic analysis Detects inputs with ill-formed parse trees

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #3 C Strings, Arrays, & Malloc 2007-06-27 Scott Beamer, Instructor Sun announces new supercomputer: Sun Constellation CS61C L3 C Pointers

More information

QUIZ. What are 3 differences between C and C++ const variables?

QUIZ. What are 3 differences between C and C++ const variables? QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,

More information

Structural Testing. Testing Tactics. Why Structural? Structural white box. Functional black box. Structural white box. Functional black box

Structural Testing. Testing Tactics. Why Structural? Structural white box. Functional black box. Structural white box. Functional black box From Pressman, Software Engineering a practitioner s approach, Chapter 14 and Pezze + Young, Software Testing and Analysis, Chapters 12-13 Structural Testing Software Engineering Andreas Zeller Saarland

More information

Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 22 Slide 1

Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 22 Slide 1 Verification and Validation Slide 1 Objectives To introduce software verification and validation and to discuss the distinction between them To describe the program inspection process and its role in V

More information

Interprocedural Analysis with Data-Dependent Calls. Circularity dilemma. A solution: optimistic iterative analysis. Example

Interprocedural Analysis with Data-Dependent Calls. Circularity dilemma. A solution: optimistic iterative analysis. Example Interprocedural Analysis with Data-Dependent Calls Circularity dilemma In languages with function pointers, first-class functions, or dynamically dispatched messages, callee(s) at call site depend on data

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 03: White-Box Testing (Textbook Ch. 5) Dietmar Pfahl Spring 2017 email: dietmar.pfahl@ut.ee Lecture Chapter 5 White-box testing techniques (Lab 3) Structure of Lecture

More information

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1 Structural Testing (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1 Learning objectives Understand rationale for structural testing How structural (code-based or glass-box) testing complements functional

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 5: Functions. Scope of variables. Program structure. Cristina Nita-Rotaru Lecture 5/ Fall 2013 1 Functions: Explicit declaration Declaration, definition, use, order matters.

More information

CS3157: Advanced Programming. Announcement

CS3157: Advanced Programming. Announcement CS3157: Advanced Programming Lecture #10 Mar 20 Shlomo Hershkop shlomo@cs.columbia.edu Announcement Welcome back from spring break Hope you ve caught up with your courses Have the exams back, will return

More information

CMPSC 497: Static Analysis

CMPSC 497: Static Analysis CMPSC 497: Static Analysis Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University Page 1 Our Goal In this course,

More information

Software Testing CS 408

Software Testing CS 408 Software Testing CS 408 1/09/18 Course Webpage: http://www.cs.purdue.edu/homes/suresh/408-spring2018 1 The Course Understand testing in the context of an Agile software development methodology - Detail

More information

CCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs

CCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs CCured Type-Safe Retrofitting of C Programs [Necula, McPeak,, Weimer, Condit, Harren] #1 One-Slide Summary CCured enforces memory safety and type safety in legacy C programs. CCured analyzes how you use

More information

Software Quality Assurance Dynamic Test

Software Quality Assurance Dynamic Test Software Quality Assurance Dynamic Test Contents Properties and goals Structural testing Control flow testing Data flow testing Functional test Diversified test 2 Properties and Goals Properties of dynamic

More information

CS64 Week 5 Lecture 1. Kyle Dewey

CS64 Week 5 Lecture 1. Kyle Dewey CS64 Week 5 Lecture 1 Kyle Dewey Overview More branches in MIPS Memory in MIPS MIPS Calling Convention More Branches in MIPS else_if.asm nested_if.asm nested_else_if.asm Memory in MIPS Accessing Memory

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 4a Andrew Tolmach Portland State University 1994-2016 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.

More information

Program Analysis. Program Analysis

Program Analysis. Program Analysis Program Analysis Class #4 Program Analysis Dynamic Analysis 1 Static VS Dynamic Analysis Static analysis operates on a model of the SW (without executing it) If successful, produces definitive information

More information

Interprocedural Dataflow Analysis. Galeotti/Gorla/Rau Saarland University

Interprocedural Dataflow Analysis. Galeotti/Gorla/Rau Saarland University Interprocedural Dataflow Analysis Galeotti/Gorla/Rau Saarland University int divbyx(int x) { [result := 10/x] 1 ; void caller1() { [x := 5] 1 ; [y := divbyx(x)] 2 ; [y := divbyx(5)] 3 ; [y := divbyx(1)]

More information