You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ dcc --version
dcc version 2.7.7
$ cat foo.c
#include <stdio.h>
int main(void) {
int x;
printf("%x\n", x);
}
$ dcc foo.c -c
foo.c:5:17: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
printf("%x\n", x);
^
foo.c:4:7: note: initialize the variable 'x' to silence this warning
int x;
^
= 0
1 warning generated.
$ ./foo
bebebebe
output without object file in the middle:
$ dcc foo.c -o foo
foo.c:5:17: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
printf("%x\n", x);
^
foo.c:4:7: note: initialize the variable 'x' to silence this warning
int x;
^
= 0
dcc explanation: It looks like you're trying to use the variable `x` on line 5 of `foo.c`.
However, on that line, the variable `x` doesn't have a value yet.
Be sure to assign a value to `x` before trying to access its value.
$ ./foo
Runtime error: uninitialized variable accessed.
Execution stopped in main() in foo.c at line 5:
int main(void) {
int x;
--> printf("%x\n", x);
}
Values when execution stopped:
x = <uninitialized value>
The text was updated successfully, but these errors were encountered:
output without object file in the middle:
The text was updated successfully, but these errors were encountered: