public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tobi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67193] New: Overzealous -Wstack-usage warning
Date: Wed, 12 Aug 2015 15:59:00 -0000	[thread overview]
Message-ID: <bug-67193-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67193

            Bug ID: 67193
           Summary: Overzealous -Wstack-usage warning
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tobi at gcc dot gnu.org
  Target Milestone: ---

-Wstack-usage throws a warning if it cannot prove that the stack is bounded. 
Therefore it is more noisy with optimization turned off.  That is fine, but
sometimes it's really too noisy, such as in this example (this is with current
trunk):

$ cat t.cc
#include <alloca.h>

void f(char *p) {
  char *q = (char*)alloca(1);
  *q = *p;
  return;
}
$ bin/g++ -c -Wstack-usage=898989 t.cc
t.cc: In function ‘void f(char*)’:
t.cc:3:6: warning: stack usage might be unbounded [-Wstack-usage=]
 void f(char *p) {
      ^
$ bin/g++ -O -c -Wstack-usage=898989 t.cc
$ bin/g++ --version
g++ (GCC) 6.0.0 20150812 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ 

Constant folding should suffice to get rid of this warning but apparently
alloca is converted to some more complicated operation before the warning is
issued.  (I know that alloca with a fixed argument is fairly pointless, but
this can happen with templates.)
>From gcc-bugs-return-494661-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 12 16:09:43 2015
Return-Path: <gcc-bugs-return-494661-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17618 invoked by alias); 12 Aug 2015 16:09:43 -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 17557 invoked by uid 48); 12 Aug 2015 16:09:39 -0000
From: "vanyacpp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63809] Missing warning on extra template
Date: Wed, 12 Aug 2015 16:09: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: 5.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vanyacpp at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
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-63809-4-vaWTmLTw8C@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63809-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63809-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: 2015-08/txt/msg00803.txt.bz2
Content-length: 510

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc809

--- Comment #2 from Ivan Sorokin <vanyacpp at gmail dot com> ---
(In reply to Marc Glisse from comment #0)
> g++ fails to warn about the extra parameter list. clang does warn, see
> PR63750.

Why is it a warning? Isn't this code incorrect? I can not find anything in
[temp.expl.spec] that forbid a code like this, but I can not find anything that
assign a specific meaning to this code either.

At least one compiler (MSVC) rejects this code with an error.


             reply	other threads:[~2015-08-12 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 15:59 tobi at gcc dot gnu.org [this message]
2015-08-15  7:52 ` [Bug c++/67193] " pinskia at gcc dot gnu.org
2015-08-15 12:30 ` tobi at gcc dot gnu.org
2021-06-03  9:58 ` tobi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67193-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).