Archive for November, 2009
Random Pics
Nov 30
Misc C++ links
Nov 30
Sanskrit Tutor
Nov 29
An online Sanskrit tutor developed by IIT Madras. Acharya – Learn Sanskrit through self study.

Gcc will not produce any warnings about uninitialized variables if the optimization level is not 1 or greater. The following code has an obvious uninitialized variable problem.
test.c
int foo() {
int x;
return x;
}
But gcc (3.4 and 4.2.1) produces no warning or error when you use this command line:
gcc -Wall -Werror -O0 test.c
gcc -Wall -Werror test.c (this defaults to -O0)
I have tested the above on Linux as well as Mac OS X.
The -Wall flag is supposed to automatically include the -Wuninitialized flag. But if the optimization level is 0 then the check for uinitialized variables is not done.
gcc -Wall -Werror -Wuninitialized test.c
If included explicitly like above:
$ gcc -Wall -Werror -Wuninitialized test.c
cc1: warnings being treated as errors
cc1: warning: -Wuninitialized is not supported without -O
For gcc to check for uninitialized variables you need to throw at least -O1 optimization.
From the gcc man page:
-Wuninitialized
Warn if an automatic variable is used without first being
initialized or if a variable may be clobbered by a “setjmp” call.
These warnings are possible only in optimizing compilation, because
they require data flow information that is computed only when
optimizing. If you do not specify -O, you will not get these
warnings. Instead, GCC will issue a warning about -Wuninitialized
requiring -O.
However, uninitialized checking does not seem to work correctly. This code compiles on Mac OS X (Snow Leopard):
#include <stdlib.h>
#include <iostream>
int main() {
int l_retVal;
unsigned int x = 1;
unsigned int y = random() % 10;
if(y == x) {
l_retVal = 2;
std::cout<<"HERE \n";
}
return l_retVal;
}
$ g++ -Wall -Werror -Wuninitialized -O test.cpp
$

BeeDocs Timeline
Nov 18
Timeline: An interesting Mac OS X App that lets you draw timelines in a cool way. The videos on the site dont seem to work (on Firefox). Works on Leopard.

- Blog on using Linux Oprofile on Ubuntu
- Using GNU’s GDB Debugger – a good introduction and tutorial.
- Compiler tools website
- Supplement to the “dragon book” (Compilers: Principles, Techniques, and Tools)
- GCC Internals
- Online version of “Linkers and Loaders” by John Levine
- Linux Journal Article on Linkers and Loaders
OpenCL Links
- ATI: An Introduction to OpenCL – Short article
- AMD: Introductory Tutorial to OpenCL – Short Article
- MacResearch OpenCL Tutorials
- OpenCL Programming Guide for Mac OS X
- Apple documentation on Concurreny and Application Design – not strictly OpenCL but concurrent programming.
- OpenCL Tutorial at GPGPU – Presented at PPAM 2009
- High Performance Computing with CUDA Tutorial at NVIDIA.com





