public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57645] New: Explicitly-declared destructor with no exception specification is always noexcept(true)
@ 2013-06-19  5:08 travis at gockelhut dot com
  2013-06-19  9:33 ` [Bug c++/57645] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: travis at gockelhut dot com @ 2013-06-19  5:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57645
           Summary: Explicitly-declared destructor with no exception
                    specification is always noexcept(true)
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: travis at gockelhut dot com

#include <type_traits>

struct Thrower
{
    ~Thrower() noexcept(false) { throw 1; }
};

struct Explicit
{
    ~Explicit() {}

    Thrower t;
};
static_assert(!std::is_nothrow_destructible<Explicit>::value, "Explicit");


This will fail on the static_assert in 4.8, in contrast to §15.4.14:

> ..If f is an...destructor...it's implicit exception-specification specifies...f has the exception-specification noexcept(true) if every function it directly invokes allows no exceptions.

And Thrower::~Thrower is directly invoked according to §12.4.8:

> After executing the body of the destructor and destroying any automatic objects allocated within the body, a destructor for class X calls the destructors for X’s direct non-variant non-static data members...
>From gcc-bugs-return-424607-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 19 05:21:51 2013
Return-Path: <gcc-bugs-return-424607-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31657 invoked by alias); 19 Jun 2013 05:21:50 -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 31563 invoked by uid 48); 19 Jun 2013 05:21:38 -0000
From: "b.r.longbons at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57646] New:=?UTF-8?Q? bogus warning about uninitialized ‘saved_stack?=.=?UTF-8?Q?1’ with gotos and VLAs?Date: Wed, 19 Jun 2013 05:21: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: b.r.longbons 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-57646-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-06/txt/msg00986.txt.bz2
Content-length: 1508

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

            Bug ID: 57646
           Summary: bogus warning about uninitialized ‘saved_stack.1’ with
                    gotos and VLAs
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.r.longbons at gmail dot com

Created attachment 30321
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30321&action=edit
minimal testcase

The attached reduced testcase gives a warning that a nonexistent variable,
'saved_stack.1', may be used uninitialized.

The testcase does not need any special compiler flags.

There are a bunch of bugs with similar descriptions, but they either don't
involve invented variables or were marked as fixed.
In particular, it looks fairly similar to bug 43013, which was fixed before
4.6.0. The differences I can see are that this only seems to happen in C++ with
VLAs.

Bad versions, all amd64:
Gentoo: 4.4.7, 4.5.4, 4.6.0, 4.6.1, 4.6.2, 4.6.3, 4.6.4, 4.7.0, 4.7.1, 4.7.2,
4.7.3
Debian: 4.6.4-2, 4.7.3-4, 4.8.1-2

4.3.6 does not exhibit this issue, but that's too old to compile the codebase
this is in. Since I haven't found a workaround short of disabling the warning,
I'm stuck with clang for now, which lacks support for a lot of other essential
warnings (*grumbles about old bug reports that still aren't fixed*).
>From gcc-bugs-return-424608-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 19 06:38:48 2013
Return-Path: <gcc-bugs-return-424608-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6122 invoked by alias); 19 Jun 2013 06:38:48 -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 6080 invoked by uid 48); 19 Jun 2013 06:38:37 -0000
From: "vijunag at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57647] New: lvalue required as increment operand
Date: Wed, 19 Jun 2013 06:38: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: 4.7.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vijunag 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57647-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-06/txt/msg00987.txt.bz2
Content-length: 2124

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

            Bug ID: 57647
           Summary: lvalue required as increment operand
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vijunag at gmail dot com

I recently upgraded my gcc compiler from 3.4.X to 4.7.2 for my project.

Consider the following expression

char *foo = &bar;
((unsigned long*)foo)++

While gcc 3.4.X was more forgiving of this issue, 4.7.2 barfs out an error
"lvalue required as increment operand".

I did notice in gcc documentation that "cast as l-value has been removed".

C and Objective-C

    The -Wstrict-aliasing=2 option has been added. This warning catches all
unsafe cases, but it may also give a warning for some cases that are safe.
    The cast-as-lvalue, conditional-expression-as-lvalue and
compound-expression-as-lvalue extensions, which were deprecated in 3.3.4 and
3.4, have been removed.
    The -fwritable-strings option, which was deprecated in 3.4, has been
removed.
    #pragma pack() semantics have been brought closer to those used by other
compilers. This also applies to C++.
    Taking the address of a variable with register storage is invalid in C. GCC
now issues an error instead of a warning.
    Arrays of incomplete element type are invalid in C. GCC now issues an error
for such arrays. Declarations such as extern struct s x[]; (where struct s has
not been defined) can be moved after the definition of struct s. Function
parameters declared as arrays of incomplete type can instead be declared as
pointers.

So the natural fix and equivalent legitimate expression for the same would
((unsigned long *)foo++), however with -Wall gcc again warns about
unused-value.

While gcc accepts the expression ((unsigned long*)foo++), the expression has
become useless when -Wall -Werror  is turned on since it throws
"-Werror=unused-value".

Either the expression should completely be removed or GCC should stop warning
about such expressions.


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

end of thread, other threads:[~2013-11-27  9:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-19  5:08 [Bug c++/57645] New: Explicitly-declared destructor with no exception specification is always noexcept(true) travis at gockelhut dot com
2013-06-19  9:33 ` [Bug c++/57645] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-06-25  8:54 ` paolo.carlini at oracle dot com
2013-06-29  0:12 ` paolo.carlini at oracle dot com
2013-07-05 10:23 ` paolo.carlini at oracle dot com
2013-11-26 23:06 ` dspeterson at tagged dot com
2013-11-26 23:35 ` daniel.kruegler at googlemail dot com
2013-11-27  9:01 ` paolo.carlini at oracle 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).