public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53159] New: Missing narrowing check
@ 2012-04-29 14:00 marc.glisse at normalesup dot org
2012-05-21 17:47 ` [Bug c++/53159] " paolo.carlini at oracle dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-29 14:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Bug #: 53159
Summary: Missing narrowing check
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: marc.glisse@normalesup.org
In this example, I get narrowing warnings for a and b but not c.
struct X
{
constexpr operator int() { return __INT_MAX__; }
};
int f(){ return __INT_MAX__; }
signed char a { __INT_MAX__ };
signed char b { f() };
signed char c { X{} };
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
@ 2012-05-21 17:47 ` paolo.carlini at oracle dot com
2012-05-21 20:55 ` paolo.carlini at oracle dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-21 17:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-21
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-21 16:11:49 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
2012-05-21 17:47 ` [Bug c++/53159] " paolo.carlini at oracle dot com
@ 2012-05-21 20:55 ` paolo.carlini at oracle dot com
2012-05-21 23:44 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-21 20:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-21 19:26:32 UTC ---
Essentially the problem is that check_narrowing doesn't know how to handle type
conversion operators or anything more sophisticated than just scalars as init
and gives up. The issue should be therefore fixable relatively easily by way of
perform_implicit_conversion of perform_implicit_conversion_flag but one must be
careful with designated initializers, scalars which can't be initialized with a
brace-enclosed initializer in C++98, special cases, otherwise reshape_init
doesn't do much in case of SCALAR_TYPE_P (type).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
2012-05-21 17:47 ` [Bug c++/53159] " paolo.carlini at oracle dot com
2012-05-21 20:55 ` paolo.carlini at oracle dot com
@ 2012-05-21 23:44 ` paolo.carlini at oracle dot com
2013-03-22 14:43 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-21 23:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
Target Milestone|--- |4.8.0
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-21 23:03:54 UTC ---
Let's see what I can do.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (2 preceding siblings ...)
2012-05-21 23:44 ` paolo.carlini at oracle dot com
@ 2013-03-22 14:43 ` jakub at gcc dot gnu.org
2013-03-22 18:17 ` paolo.carlini at oracle dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-03-22 14:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.0 |4.8.1
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-22 14:42:36 UTC ---
GCC 4.8.0 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (3 preceding siblings ...)
2013-03-22 14:43 ` jakub at gcc dot gnu.org
@ 2013-03-22 18:17 ` paolo.carlini at oracle dot com
2013-03-24 18:15 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-22 18:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.1 |---
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (4 preceding siblings ...)
2013-03-22 18:17 ` paolo.carlini at oracle dot com
@ 2013-03-24 18:15 ` paolo.carlini at oracle dot com
2014-04-22 11:35 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-24 18:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.9.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (5 preceding siblings ...)
2013-03-24 18:15 ` paolo.carlini at oracle dot com
@ 2014-04-22 11:35 ` jakub at gcc dot gnu.org
2014-07-11 21:54 ` paolo at gcc dot gnu.org
2014-07-11 21:55 ` paolo.carlini at oracle dot com
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-22 11:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.0 |4.9.1
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.0 has been released
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (6 preceding siblings ...)
2014-04-22 11:35 ` jakub at gcc dot gnu.org
@ 2014-07-11 21:54 ` paolo at gcc dot gnu.org
2014-07-11 21:55 ` paolo.carlini at oracle dot com
8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-07-11 21:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Jul 11 21:53:59 2014
New Revision: 212469
URL: https://gcc.gnu.org/viewcvs?rev=212469&root=gcc&view=rev
Log:
/cp
2014-07-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53159
* call.c (build_user_type_conversion_1): Copy LOOKUP_NO_NARROWING
into convflags.
* decl.c (check_initializer): Don't call check_narrowing here,
set LOOKUP_NO_NARROWING.
* typeck2.c (digest_init_r): Likewise.
/testsuite
2014-07-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53159
* g++.dg/cpp0x/Wnarrowing1.C: New.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/Wnarrowing1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/decl.c
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53159] Missing narrowing check
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
` (7 preceding siblings ...)
2014-07-11 21:54 ` paolo at gcc dot gnu.org
@ 2014-07-11 21:55 ` paolo.carlini at oracle dot com
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-11 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53159
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Assignee|paolo.carlini at oracle dot com |unassigned at gcc dot gnu.org
Target Milestone|4.9.1 |4.10.0
--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-07-11 21:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-29 14:00 [Bug c++/53159] New: Missing narrowing check marc.glisse at normalesup dot org
2012-05-21 17:47 ` [Bug c++/53159] " paolo.carlini at oracle dot com
2012-05-21 20:55 ` paolo.carlini at oracle dot com
2012-05-21 23:44 ` paolo.carlini at oracle dot com
2013-03-22 14:43 ` jakub at gcc dot gnu.org
2013-03-22 18:17 ` paolo.carlini at oracle dot com
2013-03-24 18:15 ` paolo.carlini at oracle dot com
2014-04-22 11:35 ` jakub at gcc dot gnu.org
2014-07-11 21:54 ` paolo at gcc dot gnu.org
2014-07-11 21:55 ` 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).