public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58877] New: Spurious warning: ‘<anonymous>’ is used uninitialized in this function
@ 2013-10-25 13:27 bluesmissionnaire at gmail dot com
  2013-10-25 13:32 ` [Bug c++/58877] " paolo.carlini at oracle dot com
  2013-10-25 13:43 ` bluesmissionnaire at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: bluesmissionnaire at gmail dot com @ 2013-10-25 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58877
           Summary: Spurious warning: ‘<anonymous>’ is used uninitialized
                    in this function
           Product: gcc
           Version: 4.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bluesmissionnaire at gmail dot com

Created attachment 31087
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31087&action=edit
source file that generates warning

g++-4.4 (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)

/usr/bin/g++-4.4 -Wall -c -O2 anonymous_may_be_used_uninitialized.cpp
warns:

anonymous_may_be_used_uninitialized.cpp: In member function ‘void
Sorter::sort()’:
anonymous_may_be_used_uninitialized.cpp:83: warning: ‘<anonymous>’ is used
uninitialized in this function

When I decrease optimization level to 1 this warning disappears.

I checked test files attached to multiple similar bugs but none of them
generated this warning. That is why I am creating a new bug.

Using http://gcc.godbolt.org/ I could check that assembly output is generated
for all gcc versions available there (v4.4.7 -> v4.8) so I suspect this problem
was somehowe fixed in 4.4.7. Anyway, I attach the code that I managed to get
and still have this warning. Maybe you want to add this to your regression
suite.
>From gcc-bugs-return-432735-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 25 13:28:15 2013
Return-Path: <gcc-bugs-return-432735-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2536 invoked by alias); 25 Oct 2013 13:28:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2503 invoked by uid 48); 25 Oct 2013 13:28:12 -0000
From: "roger.ferrer at bsc dot es" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58878] New: Template parameter name can be hidden in a template member function defined inside the class specifier
Date: Fri, 25 Oct 2013 13:28:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: roger.ferrer at bsc dot es
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58878-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01879.txt.bz2
Content-length: 3485

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

            Bug ID: 58878
           Summary: Template parameter name can be hidden in a template
                    member function defined inside the class specifier
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

g++ allows declarations to hide a template-parameter name in template member
functions defined inside the class-specifier.

I have not been able to find whether this was expected behaviour in g++ so
I'm inclined to believe this is an error in g++.

Following is a testcase where several declarations attempt to hide
template-parameter names 't' and 's' in the scope.

g++ accepts cases 1, 5 and 6 and (I think) it should not allow them. The
remaining cases seem to be correctly diagnosed.

This fails both in g++ 4.8.1 and g++ 4.9.0 20131015 (experimental).

-- test.c
// Template-members of non-template class
struct A
{
    template <typename t>
        void f()
        {
            int t = 1; // Error. g++ does NOT complain
        }

    template <typename t>
        void g();
};

template <typename t>
void A::g()
{
    int t = 2; // OK. g++ DOES complain
}

// (Non-template) Members of template class
template <typename t>
struct B
{
    void f()
    {
        int t = 3; // OK. g++ DOES complain
    }

    void g();
};

template <typename t>
void B<t>::g()
{
    int t = 4; // OK. g++ DOES complain
}


// Template members of template class
template <typename t>
struct C
{
    template <typename s>
    void f()
    {
        int t = 5; // Error. g++ does NOT complain
        int s = 6; // Error. g++ does NOT complain
    }

    template <typename s>
    void g();
};

template <typename t>
template <typename s>
void C<t>::g()
{
    int t = 7; // OK. g++ DOES complain
    int s = 8; // OK. g++ DOES complain
}
-- end of test.cc

$ g++ -c test.cc
test.cc: In member function ‘void A::g()’:
test.cc:17:9: error: declaration of ‘int t’
     int t = 2; // OK. g++ DOES complain
         ^
test.cc:14:11: error:  shadows template parm ‘class t’
 template <typename t>
           ^
test.cc: In member function ‘void B<t>::f()’:
test.cc:26:13: error: declaration of ‘int t’
         int t = 3; // OK. g++ DOES complain
             ^
test.cc:21:11: error:  shadows template parm ‘class t’
 template <typename t>
           ^
test.cc: In member function ‘void B<t>::g()’:
test.cc:35:9: error: declaration of ‘int t’
     int t = 4; // OK. g++ DOES complain
         ^
test.cc:32:11: error:  shadows template parm ‘class t’
 template <typename t>
           ^
test.cc: In member function ‘void C<t>::g()’:
test.cc:58:9: error: declaration of ‘int t’
     int t = 7; // OK. g++ DOES complain
         ^
test.cc:54:11: error:  shadows template parm ‘class t’
 template <typename t>
           ^
test.cc:59:9: error: declaration of ‘int s’
     int s = 8; // OK. g++ DOES complain
         ^
test.cc:55:11: error:  shadows template parm ‘class s’
 template <typename s>

I'd expect error messages for 1, 5 and 6 to appear as well.

Kind regards,
>From gcc-bugs-return-432736-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 25 13:28:23 2013
Return-Path: <gcc-bugs-return-432736-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3191 invoked by alias); 25 Oct 2013 13:28:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3042 invoked by uid 48); 25 Oct 2013 13:28:19 -0000
From: "bluesmissionnaire at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58877] Spurious warning:=?UTF-8?Q? ‘?=<anonymous>=?UTF-8?Q?’ is used uninitialized in this function?Date: Fri, 25 Oct 2013 13:28:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.4.6
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bluesmissionnaire at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-58877-4-suu5eK2ko3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58877-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58877-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01880.txt.bz2
Content-length: 332

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

--- Comment #1 from Przemysław Strzelczak <bluesmissionnaire at gmail dot com> ---
Created attachment 31088
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31088&action=edit
/usr/bin/g++-4.4 -Wall -Wextra -save-temps -c -O2
anonymous_may_be_used_uninitialized.cpp
>From gcc-bugs-return-432737-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 25 13:30:07 2013
Return-Path: <gcc-bugs-return-432737-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4992 invoked by alias); 25 Oct 2013 13:30:05 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 4846 invoked by uid 48); 25 Oct 2013 13:30:03 -0000
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58789] [4.8 Regression] "internal compiler error: Segmentation fault" with external definition
Date: Fri, 25 Oct 2013 13:30:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jamborm at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to
Message-ID: <bug-58789-4-QLbw4Bz1tM@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58789-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58789-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01881.txt.bz2
Content-length: 775

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX789

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jamborm at gcc dot gnu.org

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
OK, I did the bisecting and the bug has been properly fixed on trunk
by http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00366.html

I did not want to backport it unless there was a bug but since there
is one now, I am going to backport both r196750 and r198743 to the 4.8
branch after testing (Honza has pre-approved it in person).


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

* [Bug c++/58877] Spurious warning: ‘<anonymous>’ is used uninitialized in this function
  2013-10-25 13:27 [Bug c++/58877] New: Spurious warning: ‘<anonymous>’ is used uninitialized in this function bluesmissionnaire at gmail dot com
@ 2013-10-25 13:32 ` paolo.carlini at oracle dot com
  2013-10-25 13:43 ` bluesmissionnaire at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-25 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Cannot reproduce in active branches.


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

* [Bug c++/58877] Spurious warning: ‘<anonymous>’ is used uninitialized in this function
  2013-10-25 13:27 [Bug c++/58877] New: Spurious warning: ‘<anonymous>’ is used uninitialized in this function bluesmissionnaire at gmail dot com
  2013-10-25 13:32 ` [Bug c++/58877] " paolo.carlini at oracle dot com
@ 2013-10-25 13:43 ` bluesmissionnaire at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: bluesmissionnaire at gmail dot com @ 2013-10-25 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Przemysław Strzelczak <bluesmissionnaire at gmail dot com> ---
Just confirmed the warning does not show up on g++-4.4 (GCC) 4.4.7 20120313
(Red Hat 4.4.7-1)
>From gcc-bugs-return-432740-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 25 13:49:57 2013
Return-Path: <gcc-bugs-return-432740-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21056 invoked by alias); 25 Oct 2013 13:49:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 21013 invoked by uid 55); 25 Oct 2013 13:49:53 -0000
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58282] g++.dg/tm/noexcept-1.C -fno-exceptions SIGSEGV in gimple_build_eh_must_not_throw
Date: Fri, 25 Oct 2013 13:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: EH, ice-on-valid-code, patch, trans-mem
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vries at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58282-4-7RgfJ2UKrf@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58282-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58282-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01884.txt.bz2
Content-length: 638

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX282

--- Comment #9 from vries at gcc dot gnu.org ---
Author: vries
Date: Fri Oct 25 13:49:48 2013
New Revision: 204067

URL: http://gcc.gnu.org/viewcvs?rev 4067&root=gcc&view=rev
Log:
2013-10-25  Tom de Vries  <tom@codesourcery.com>

    PR c++/58282
    * except.c (build_must_not_throw_expr): Handle
    flag_exceptions.

    * g++.dg/tm/noexcept-6.C: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/tm/noexcept-6.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/except.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-10-25 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 13:27 [Bug c++/58877] New: Spurious warning: ‘<anonymous>’ is used uninitialized in this function bluesmissionnaire at gmail dot com
2013-10-25 13:32 ` [Bug c++/58877] " paolo.carlini at oracle dot com
2013-10-25 13:43 ` bluesmissionnaire at gmail dot com

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).