Compiling the attached piece of code produces this:
foo.c: In function 'bar': foo.c:8: warning: 'bar_thing.member' is used uninitialized in this function but line 8 is in foo(), not bar, and bar_thing isn't in scope. It has inlined foo (confirmed in the assembler output) and it's reporting about the inlined assignment, but it's doing so in a... less than desirable way. When I hit this on real source, the inlined function and the call site were 1000 lines apart, and the reported name of the variable at the call site (equivalent to "bar_thing") was not illuminating, so I had to get most of the way through preparing the minimal bug report before I realized what was going on. I've seen this on several configurations of gcc 4.1.2 (and also the pre-4.1.3 snap NetBSD is currently using) but I don't have any newer gccs than that on hand. If you don't care because nobody cares about 4.1 any more and it doesn't repeat on newer gccs, oh well. Environment: System: NetBSD tanaqui 4.99.54 NetBSD 4.99.54 (TANAQUI) #21: Fri Feb 29 12:31:31 EST 2008 [EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/TANAQUI i386 host: i386-unknown-netbsdelf4.99.19 build: i386-unknown-netbsdelf4.99.19 target: mips-unknown-linux-gnu configured with: /home/dholland/projects/os161/toolchain/work2007/test-gcc/./gcc-4.1.2+cs161/configure --target=mips-linux --nfp --disable-shared --disable-threads --disable-libmudflap --disable-libssp --prefix=/home/dholland/cs161/tools How-To-Repeat: gcc -Wall -O -c foo.i foo.i: ------------ # 1 "foo.c" # 1 "<built-in>" # 1 "<command line>" # 1 "foo.c" struct thing { int member; }; struct thing *external; static void foo(struct thing foo_thing) { *external = foo_thing; } void bar(void) { struct thing bar_thing; foo(bar_thing); } ------------ -- Summary: uninitialized-variable warning misnames program objects after inlining Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dholland at eecs dot harvard dot edu GCC build triplet: i386-unknown-netbsdelf4.99.19 GCC host triplet: i386-unknown-netbsdelf4.99.19 GCC target triplet: mips-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36951