Find the Bug Challenge

What is the “Find the Bug Challenge”? In order to demonstrate the scope of CodePeer’s code analysis capabilities we thought we’d have a little fun and each month post a simple piece of code that contains a few tricky bugs, so that you can measure your bug-finding capacities to those of CodePeer.

Challenge 1 – Uninitialized variables and fields

This code defines a library Contacts of helper functions (Complete, Get_By_Name, Get_By_Phone) that access a database of contacts stored in an array. A contact is a record gathering the name, address and phone number of a person. Take the Challenge »

Challenge 2 – Unused assignments and conditions predetermined

This code defines a function Cruise.Control which computes a mode for automatically controlling a car speed, given the information provided by sensors on the position and speed of surrounding vehicles. The mode distinguishes various levels of breaking and speeding. Take the Challenge »

Challenge 3 – Discriminant record and null pointer

This package defines the configuration of a player in an adventure computer game. Type Gameplay defines the various modes that the player can adopt. Depending on this mode, various features are defined, which determine the hourly energy consumption of the player. Take the Challenge »

Challenge 4 – Protected objects, tasks and race conditions

This package defines tasks to track friendly and enemy ships, based on a protected type defining a short list of nearby ships. A flag is set when the combat zone becomes crowded, in order to switch to a different combat mode. Take the Challenge »

Challenge 5 – Dead, unused, predetermined and suspicious code

The package Conductor defines an automated conductor for an orchestra, which is updated both periodically every few micro-seconds (entry Advance of task Concert) and each time a sensor detects that a musician plays a new note (entry Start_Of_Note of task Concert). Take the Challenge »

Challenge 6 – Generated preconditions and postconditions

This electronic coaching program helps you monitor your (daily? weekly? not even?) running activities by automatically following a training program of your choice. Take the Challenge »

Challenge 7 – Initialization, array checks and range checks

Ever found yourself not knowing what to put in this backpack your little one is carrying to school? This helper program does it for you, or your kid, or your kid’s teacher. Because not everyone has the same priorities. Take the Challenge »

Challenge 8 – Dynamic Dispatching, Dead Code and Floats

With electronic voting adding up to the heat of election nights, every citizen might be interested in getting some strong assurance that the machine is doing its job, especially since there might be a disclaimer that “no warranty is given on the exactitude of the next president chosen by the software”. Here, you have the source code to check it for yourself! Take the Challenge »

Challenge 9 – Checking User-Specified Contracts

Ever wondered how a drowsy pilot might react to wings having bad vibrations on a diverging plane? Well, let’s explore the possibilities in this small automaton with 3^5 states. Take the Challenge »