public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67193] New: Overzealous -Wstack-usage warning
@ 2015-08-12 15:59 tobi at gcc dot gnu.org
2015-08-15 7:52 ` [Bug c++/67193] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tobi at gcc dot gnu.org @ 2015-08-12 15:59 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67193] Overzealous -Wstack-usage warning
2015-08-12 15:59 [Bug c++/67193] New: Overzealous -Wstack-usage warning tobi at gcc dot gnu.org
@ 2015-08-15 7:52 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-08-15 7:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67193
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>(I know that alloca with a fixed argument is fairly pointless, but this can happen with templates.)
Why not use normal arrays for that case?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67193] Overzealous -Wstack-usage warning
2015-08-12 15:59 [Bug c++/67193] New: Overzealous -Wstack-usage warning tobi at gcc dot gnu.org
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
2 siblings, 0 replies; 4+ messages in thread
From: tobi at gcc dot gnu.org @ 2015-08-15 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67193
--- Comment #2 from Tobias Schlüter <tobi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> >(I know that alloca with a fixed argument is fairly pointless, but this can happen with templates.)
>
> Why not use normal arrays for that case?
Well, I could of course rewrite the code to get rid of a pointless warning ...
>From gcc-bugs-return-494902-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Aug 15 12:46:56 2015
Return-Path: <gcc-bugs-return-494902-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 95284 invoked by alias); 15 Aug 2015 12:46: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 95219 invoked by uid 48); 15 Aug 2015 12:46:52 -0000
From: "nico.schloemer at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/36750] -Wmissing-field-initializers relaxation request
Date: Sat, 15 Aug 2015 12:46: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.1.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: nico.schloemer at gmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
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: cc
Message-ID: <bug-36750-4-KpqYWSKnPt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-36750-4@http.gcc.gnu.org/bugzilla/>
References: <bug-36750-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/msg01044.txt.bz2
Content-length: 647
https://gcc.gnu.org/bugzilla/show_bug.cgi?id6750
Nico <nico.schloemer at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nico.schloemer at gmail dot com
--- Comment #13 from Nico <nico.schloemer at gmail dot com> ---
Apparently, this got fixed for C++ somewhere inbetween GCC 4.9.2 and 5.1.1.
```
int main() {
struct S {
int a;
float b;
};
S s = {}; // identical to S s = {0, 0.0, std::string};
}
```
Compiled with `-Wextra`, the warning isn't present anymore for GCC 5.1.1.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67193] Overzealous -Wstack-usage warning
2015-08-12 15:59 [Bug c++/67193] New: Overzealous -Wstack-usage warning tobi at gcc dot gnu.org
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
2 siblings, 0 replies; 4+ messages in thread
From: tobi at gcc dot gnu.org @ 2021-06-03 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67193
Tobias Schlüter <tobi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.0, 11.1.0
--- Comment #4 from Tobias Schlüter <tobi at gcc dot gnu.org> ---
Confirmed with 10.3 and 11.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-03 9:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12 15:59 [Bug c++/67193] New: Overzealous -Wstack-usage warning tobi at gcc dot gnu.org
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
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).