public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60742] New: ill-formed declarator (array) in selection statement not caught appropriately
@ 2014-04-02 20:31 filip.roseen at gmail dot com
2014-12-14 16:28 ` [Bug c++/60742] " ville.voutilainen at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: filip.roseen at gmail dot com @ 2014-04-02 20:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60742
Bug ID: 60742
Summary: ill-formed declarator (array) in selection statement
not caught appropriately
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32527
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32527&action=edit
testcase.cpp
int main () {
if (int a[3] = {1,2,3}) {
(void)a;
}
}
-------------------------------------------------------------
[stmt.select]p2:
> The rules for conditions apply both to selction-statements and to
> the for and while statements (6.5) __The declarator shall not
> specify a function or an array.__ If the auto type-specifier appears
> in the decl-specifier-seq, the type of the identifier being
> declared is deduced from the initializer as described in 7.1.6.4.
-------------------------------------------------------------
H20:/tmp% g++ -std=c++11 -pedantic-errors testcase.cpp;
H20:/tmp% g++ -std=c++11 -pedantic-errors -Waddress testcase.cpp;
testcase.cpp: In function ‘int main()’:
testcase.cpp:2:25: warning: the address of ‘a’ will always evaluate as ‘true’
[-Waddress]
if (int a[3] = {1,2,3}) {
-------------------------------------------------------------
As seen above a diagnostic is only issued if we do `-Waddress` (or some warning
flag that includes the mentioned one).
The problem isn't actually with the address of `a` always evaluting to `true`,
the major problem is that this kind of code is ill-formed; gcc should therefore
reject it.
[ Note: `clang` and `icc` both handles this correctly (ie. rejects it) ]
>From gcc-bugs-return-448149-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 02 20:55:40 2014
Return-Path: <gcc-bugs-return-448149-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3658 invoked by alias); 2 Apr 2014 20:55:39 -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 3602 invoked by uid 55); 2 Apr 2014 20:55:35 -0000
From: "vmakarov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/60650] [ARM] LRA ICE in assign_by_spills
Date: Wed, 02 Apr 2014 20:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vmakarov at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60650-4-MNW5LpjNfj@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60650-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60650-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: 2014-04/txt/msg00169.txt.bz2
Content-length: 721
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`650
--- Comment #12 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Author: vmakarov
Date: Wed Apr 2 20:55:02 2014
New Revision: 209038
URL: http://gcc.gnu.org/viewcvs?rev 9038&root=gcc&view=rev
Log:
2014-04-02 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/60650
* lra-constraints.c (process_alt_operands): Decrease reject for
earlyclobber matching.
2014-04-02 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/60650
* gcc.target/arm/pr60650-2.c: New.
Added:
trunk/gcc/testsuite/gcc.target/arm/pr60650-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/60742] ill-formed declarator (array) in selection statement not caught appropriately
2014-04-02 20:31 [Bug c++/60742] New: ill-formed declarator (array) in selection statement not caught appropriately filip.roseen at gmail dot com
@ 2014-12-14 16:28 ` ville.voutilainen at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60742
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1, 5.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-14 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-02 20:31 [Bug c++/60742] New: ill-formed declarator (array) in selection statement not caught appropriately filip.roseen at gmail dot com
2014-12-14 16:28 ` [Bug c++/60742] " ville.voutilainen 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).