Bug 40654 - [C++0x] atomic.cc: 'd' is used uninitialized warning
Summary: [C++0x] atomic.cc: 'd' is used uninitialized warning
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: 4.4.3
Assignee: Benjamin Kosnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-05 14:39 UTC by Ozkan Sezer
Modified: 2009-10-19 16:46 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-mingw32
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-07-06 23:55:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2009-07-05 14:39:24 UTC
During compilation of libstdc++ for i686-pc-mingw32, I noticed this warning:

../../../../gcc44-svn/libstdc++-v3/src/atomic.cc:83: warning: 'd' is used uninitialized in this function
../../../../gcc44-svn/libstdc++-v3/src/atomic.cc:83: note: 'd' was declared here

Notice the 'is used' and not 'maybe used'.  The warning was noted with gcc shapshot r149016 from gcc-4_4-branch.  Does not happen for x86_64-pc-mingw32.  The toolchain was compiled against mingw-w64 header-set and crt.
Comment 1 Paolo Carlini 2009-07-05 18:08:48 UTC
Benjamin, can you have a look? To me, it seems a back-end issue in the compiler, because I don't see anything wrong in the code...
Comment 2 Benjamin Kosnik 2009-07-06 23:55:04 UTC
Yes, I will look at this. I think Ben Elliston pointed this out right after 4.4.0 was released, along with some other uninitialized warnings that I then fixed. 

Apparently this is also visible on ppc.

Comment 3 Paolo Carlini 2009-07-22 14:28:51 UTC
See also PR40825.
Comment 4 Benjamin Kosnik 2009-10-16 07:47:54 UTC
Subject: Bug 40654

Author: bkoz
Date: Fri Oct 16 07:47:33 2009
New Revision: 152895

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152895
Log:
2009-10-15  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/40654
	PR libstdc++/40826
	* src/atomic.cc (atomic_flag_test_and_set_explicit): Add
	static_cast from base to derived.
	(atomic_flag_clear_explicit): Same.
	* include/bits/atomic_2.h (__atomic2::atomic_flag): Public derivation.
	Remove value type constructor.
	* include/bits/atomic_0.h (__atomic0::atomic_flag): Same.
	* include/std/future (_Future_state): Use ATOMIC_FLAG_INIT to
	initialized the atomic_flag member.


Added:
    trunk/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/
    trunk/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c
    trunk/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/atomic_0.h
    trunk/libstdc++-v3/include/bits/atomic_2.h
    trunk/libstdc++-v3/include/std/future
    trunk/libstdc++-v3/src/atomic.cc

Comment 5 Ozkan Sezer 2009-10-16 19:49:16 UTC
Any chance for a backport to 4.4 ?
Comment 6 Benjamin Kosnik 2009-10-18 03:30:20 UTC
Subject: Bug 40654

Author: bkoz
Date: Sun Oct 18 03:30:03 2009
New Revision: 152965

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152965
Log:
2009-10-16  Benjamin Kosnik  <bkoz@redhat.com>

        * include/c_compatibility/stdatomic.h: Include cstdatomic if
        __cplusplus.

2009-10-15  Benjamin Kosnik  <bkoz@redhat.com>

        PR libstdc++/40654
        PR libstdc++/40826
        * src/atomic.cc (atomic_flag_test_and_set_explicit): Add
        static_cast from base to derived.
        (atomic_flag_clear_explicit): Same.
        * include/bits/atomic_2.h (__atomic2::atomic_flag): Public derivation.
        Remove value type constructor.
        * include/bits/atomic_0.h (__atomic0::atomic_flag): Same.
        * include/std/future (_Future_state): Use ATOMIC_FLAG_INIT to
        initialized the atomic_flag member.

Added:
    branches/gcc-4_4-branch/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/
    branches/gcc-4_4-branch/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c
    branches/gcc-4_4-branch/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.cc
    branches/gcc-4_4-branch/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
Modified:
    branches/gcc-4_4-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_4-branch/libstdc++-v3/include/bits/atomic_0.h
    branches/gcc-4_4-branch/libstdc++-v3/include/bits/atomic_2.h
    branches/gcc-4_4-branch/libstdc++-v3/include/c_compatibility/stdatomic.h
    branches/gcc-4_4-branch/libstdc++-v3/src/atomic.cc

Comment 7 Benjamin Kosnik 2009-10-19 16:46:40 UTC
In for gcc-4.4.3