When compiling GDB 6.5.90 on x86 (FC5) GCC gives following warning. So it is needed to initialize tmp_obstack to avoid this warning. This isn't necessary and GCC should detect this. /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c: In function 'pascal_object_print_value_fields': /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.alloc_failed' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.maybe_empty_object' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.use_extra_arg' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.extra_arg' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.freefun' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.chunkfun' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.alignment_mask' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.temp' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.chunk_limit' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.next_free' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.object_base' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.chunk' may be used uninitialized in this function /home/user/gdb/6.5.90/gdb-6.5.90/gdb/p-valprint.c:756: warning: 'tmp_obstack.chunk_size' may be used uninitialized in this function make[2]: *** [p-valprint.o] Error 1 make[2]: Leaving directory `/home/user/gdb/6.5.90/gdb-6.5.90/build_werr/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/home/user/gdb/6.5.90/gdb-6.5.90/build_werr' make: *** [all] Error 2
Depends how the source looks, it might be actually used uninitialized which means the code is undefined anyways. Can you attach the preprocessed source? I have seen stuff like: struct a{int t; int t1}; void f(struct a); void g(void) { struct a b; b.t = 1; f(b); } (maybe a little more complex but you get the idea). How does GCC know that not all the elements of b are not used.
Created attachment 12764 [details] Source file mentioned in the description
I attached the file. Its from GDB 6.5.90 release.
The problem here is the same as PR 5035 really, just this case has structs and the other case is for scalars but the problems are the same. *** This bug has been marked as a duplicate of 5035 ***