Skip to content

Commit b5f5af6

Browse files
committed
handle exit with uninitialized value
1 parent 099db54 commit b5f5af6

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
Runtime error: exit value is uninitialized
4+
5+
Main is returning an uninitialized value or exit has been passed an uninitialized value.
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
Runtime error: exit value is uninitialized
4+
5+
Main is returning an uninitialized value or exit has been passed an uninitialized value.
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
Runtime error: exit value is uninitialized
4+
5+
Main is returning an uninitialized value or exit has been passed an uninitialized value.
6+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// A simple C program that attempts to be punny
2+
// Written 23/2/2017
3+
// by Angela Finlayson ([email protected])
4+
// for COMP1511 Lab 01 Exercise 1
5+
6+
#include <stdio.h>
7+
8+
int main(int argc, char *argv[]) {
9+
int a[2];
10+
a[0] = 0;
11+
printf("Hello, it is good to C you!\n");
12+
13+
return a[argc];
14+
}

watch_valgrind.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ def watch_valgrind():
2727
sys.stderr.flush()
2828
start_gdb()
2929
break
30+
elif 'exit_group(status)' in line:
31+
error = f"""Runtime error: {color('exit value is uninitialized', 'red')}
32+
33+
Main is returning an uninitialized value or exit has been passed an uninitialized value.
34+
"""
35+
os.environ['DCC_VALGRIND_ERROR'] = error
36+
print('\n' + error, file=sys.stderr)
37+
start_gdb()
38+
sys.exit(1)
3039
elif 'below stack pointer' in line:
3140
error = f"""Runtime error: {color('access to function variables after function has returned', 'red')}
3241
You have used a pointer to a local variable that no longer exists.

0 commit comments

Comments
 (0)