public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof @ 2013-04-12 7:11 jens.maurer at gmx dot net 2013-05-22 14:06 ` [Bug c++/56930] [4.8/4.9 regression] " jason at gcc dot gnu.org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: jens.maurer at gmx dot net @ 2013-04-12 7:11 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Bug #: 56930 Summary: regression: pointless -Wconversion warning with sizeof Classification: Unclassified Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jens.maurer@gmx.net int main() { int x = sizeof(int); int y { sizeof(int) }; } $ g++ -Wconversion -std=c++11 conv.cc conv.cc: In function ‘int main()’: conv.cc:3:17: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Wconversion] int x = sizeof(int); ^ gcc 4.7.x didn't warn about this case, and rightly so: There should be no conversion warnings triggered if the compiler can detect that the value in question is constant and no narrowing actually happens. conv.cc:4:17: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Wconversion] int y { sizeof(int) }; ^ The warning in this case is even more confusing: The compiler should generate a language-mandated diagnostic if narrowing a non-constant, but the warning is just besides the point at all. >From gcc-bugs-return-419890-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 12 07:22:25 2013 Return-Path: <gcc-bugs-return-419890-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 929 invoked by alias); 12 Apr 2013 07:22:25 -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 870 invoked by uid 48); 12 Apr 2013 07:22:22 -0000 From: "zeratul976 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52748] [4.9 Regression][C++11] N3276 changes to decltype Date: Fri, 12 Apr 2013 07:22: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-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: zeratul976 at hotmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.1 X-Bugzilla-Changed-Fields: Message-ID: <bug-52748-4-9tTnUIOrx1@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-52748-4@http.gcc.gnu.org/bugzilla/> References: <bug-52748-4@http.gcc.gnu.org/bugzilla/> X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg01035.txt.bz2 Content-length: 985 http://gcc.gnu.org/bugzilla/show_bug.cgi?idR748 --- Comment #16 from Nathan Ridge <zeratul976 at hotmail dot com> 2013-04-12 07:22:20 UTC --- (In reply to comment #15) > (In reply to comment #14) > > Here is a related example that still fails to compile: > > Fixed. It still fails if we make S a template: template <int> struct A; template <typename T> struct B : A<sizeof(T)> {}; template <typename F> B<typename F::type> operator-(F); template <typename T> struct S { struct F { typedef S type; }; auto foo() -> decltype(-F()); }; int main() { S<int> s; } test.cpp: In instantiation of 'struct B<S<int> >': test.cpp:16:28: required from 'struct S<int>' test.cpp:21:12: required from here test.cpp:3:42: error: invalid application of 'sizeof' to incomplete type 'S<int>' template <typename T> struct B : A<sizeof(T)> {}; ^ Tested with r197837. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8/4.9 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net @ 2013-05-22 14:06 ` jason at gcc dot gnu.org 2013-05-22 14:37 ` jakub at gcc dot gnu.org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: jason at gcc dot gnu.org @ 2013-05-22 14:06 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2013-05-22 CC| |jason at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org Target Milestone|--- |4.8.1 Summary|regression: pointless |[4.8/4.9 regression] |-Wconversion warning with |pointless -Wconversion |sizeof |warning with sizeof Ever confirmed|0 |1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8/4.9 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net 2013-05-22 14:06 ` [Bug c++/56930] [4.8/4.9 regression] " jason at gcc dot gnu.org @ 2013-05-22 14:37 ` jakub at gcc dot gnu.org 2013-05-23 4:21 ` [Bug c++/56930] [4.8 " jason at gcc dot gnu.org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu.org @ 2013-05-22 14:37 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So perhaps for the purposes of the -Wconversion warning we also want to t = fold_nondependent_expr_sfinae (expr, tf_none); t = maybe_const_value (t); before warnings_for_convert_and_check call and pass the result of that instead of expr? ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net 2013-05-22 14:06 ` [Bug c++/56930] [4.8/4.9 regression] " jason at gcc dot gnu.org 2013-05-22 14:37 ` jakub at gcc dot gnu.org @ 2013-05-23 4:21 ` jason at gcc dot gnu.org 2013-05-30 19:22 ` jason at gcc dot gnu.org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: jason at gcc dot gnu.org @ 2013-05-23 4:21 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[4.8/4.9 regression] |[4.8 regression] pointless |pointless -Wconversion |-Wconversion warning with |warning with sizeof |sizeof --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed for 4.9 so far. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net ` (2 preceding siblings ...) 2013-05-23 4:21 ` [Bug c++/56930] [4.8 " jason at gcc dot gnu.org @ 2013-05-30 19:22 ` jason at gcc dot gnu.org 2013-05-31 10:58 ` jakub at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: jason at gcc dot gnu.org @ 2013-05-30 19:22 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Bug 56930 depends on bug 57391, which changed state. Bug 57391 Summary: [4.9 Regression] ICE compiling AIX math.h caused by PR c++/56930 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57391 What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |FIXED ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net ` (3 preceding siblings ...) 2013-05-30 19:22 ` jason at gcc dot gnu.org @ 2013-05-31 10:58 ` jakub at gcc dot gnu.org 2013-05-31 13:06 ` jason at gcc dot gnu.org 2014-05-07 16:10 ` jakub at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu.org @ 2013-05-31 10:58 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.8.1 |4.8.2 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- GCC 4.8.1 has been released. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net ` (4 preceding siblings ...) 2013-05-31 10:58 ` jakub at gcc dot gnu.org @ 2013-05-31 13:06 ` jason at gcc dot gnu.org 2014-05-07 16:10 ` jakub at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: jason at gcc dot gnu.org @ 2013-05-31 13:06 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed for 4.8.2. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/56930] [4.8 regression] pointless -Wconversion warning with sizeof 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net ` (5 preceding siblings ...) 2013-05-31 13:06 ` jason at gcc dot gnu.org @ 2014-05-07 16:10 ` jakub at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu.org @ 2014-05-07 16:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Wed May 7 16:09:41 2014 New Revision: 210178 URL: http://gcc.gnu.org/viewcvs?rev=210178&root=gcc&view=rev Log: Backported from mainline 2013-11-28 Jakub Jelinek <jakub@redhat.com> PR c++/59297 * semantics.c (finish_omp_atomic): Call finish_expr_stmt rather than add_stmt. * g++.dg/gomp/pr59297.C: New test. 2013-05-31 Jason Merrill <jason@redhat.com> PR c++/56930 * semantics.c (potential_constant_expression_1): Handle OMP_ATOMIC*. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/gomp/pr59297.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/semantics.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-05-07 16:10 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-04-12 7:11 [Bug c++/56930] New: regression: pointless -Wconversion warning with sizeof jens.maurer at gmx dot net 2013-05-22 14:06 ` [Bug c++/56930] [4.8/4.9 regression] " jason at gcc dot gnu.org 2013-05-22 14:37 ` jakub at gcc dot gnu.org 2013-05-23 4:21 ` [Bug c++/56930] [4.8 " jason at gcc dot gnu.org 2013-05-30 19:22 ` jason at gcc dot gnu.org 2013-05-31 10:58 ` jakub at gcc dot gnu.org 2013-05-31 13:06 ` jason at gcc dot gnu.org 2014-05-07 16:10 ` jakub 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).