public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36951]  New: uninitialized-variable warning misnames program objects after inlining
@ 2008-07-27 20:07 gcc-bugzilla at gcc dot gnu dot org
  2008-07-27 20:36 ` [Bug middle-end/36951] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2008-07-27 20:07 UTC (permalink / raw)
  To: gcc-bugs



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 dholland@tanaqui:/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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/36951] uninitialized-variable warning misnames program objects after inlining
  2008-07-27 20:07 [Bug c/36951] New: uninitialized-variable warning misnames program objects after inlining gcc-bugzilla at gcc dot gnu dot org
@ 2008-07-27 20:36 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-27 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-07-27 20:35 -------
In 4.3 (maybe even 4.2), we get an extra note:
t.c: In function 'bar':
t.c:8: warning: 'bar_thing.member' is used uninitialized in this function
t.c:12: note: 'bar_thing.member' was declared here

So I think I can declare this as being fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |middle-end
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36951


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-27 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-27 20:07 [Bug c/36951] New: uninitialized-variable warning misnames program objects after inlining gcc-bugzilla at gcc dot gnu dot org
2008-07-27 20:36 ` [Bug middle-end/36951] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).