public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function @ 2015-06-07 15:31 mosra at centrum dot cz 2015-06-08 17:48 ` [Bug c++/66450] " daniel.kruegler at googlemail dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: mosra at centrum dot cz @ 2015-06-07 15:31 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 Bug ID: 66450 Summary: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mosra at centrum dot cz Target Milestone: --- The following code is compiled fine in both GCC 4.9.2 and Clang 3.6: struct foo { constexpr foo(int a); constexpr foo(int a, int b, int c): a{a}, b{b}, c{c} {} int a, b, c; }; constexpr foo make_foo(int a) { return foo{a, a+1, a+2}; } constexpr foo::foo(int a): foo{make_foo(a)} {} int main() { constexpr const foo f{3}; static_assert(f.a == 3, ""); static_assert(f.b == 4, ""); static_assert(f.c == 5, ""); } In GCC 5.1 it produces an error about non-constant condition for static assertion. If the relevant lines are changed to runtime assert (and #include <cassert> added): assert(f.a == 3); assert(f.b == 4); assert(f.c == 5); Then all three assertions fail at runtime, because the copy constructor is somehow not called and the structure is instead just zeroed out. HOWEVER, if you remove all occurrences of the constexpr keyword, the code compiles, no runtime assertion is fired and everything behaves as expected. The behavior is the same for -std=c++11 and -std=c++14. I think the static assertion error and the zero-initialization are somehow related, so I put these into single issue instead of creating two separate ones. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/66450] [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function 2015-06-07 15:31 [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function mosra at centrum dot cz @ 2015-06-08 17:48 ` daniel.kruegler at googlemail dot com 2015-06-11 15:45 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: daniel.kruegler at googlemail dot com @ 2015-06-08 17:48 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- The problem also occurs in gcc HEAD 6.0.0 20150607 (experimental) >From gcc-bugs-return-488407-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jun 08 18:04:39 2015 Return-Path: <gcc-bugs-return-488407-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 33442 invoked by alias); 8 Jun 2015 18:04: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 33414 invoked by uid 48); 8 Jun 2015 18:04:34 -0000 From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/66461] ICE on missing end program in fixed source Date: Mon, 08 Jun 2015 18:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gmx dot de X-Bugzilla-Status: UNCONFIRMED 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: cc Message-ID: <bug-66461-4-7c2NluP4lj@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-66461-4@http.gcc.gnu.org/bugzilla/> References: <bug-66461-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-06/txt/msg00739.txt.bz2 Content-length: 1136 https://gcc.gnu.org/bugzilla/show_bug.cgi?idf461 Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #1 from Harald Anlauf <anlauf at gmx dot de> --- (In reply to Gerhard Steinmetz from comment #0) > A missing end program in a "fixed" source s.f : > program p > integer x(2) > x = 0 > if ( x(1) < 0 .or. > & x(2) < 0 ) print *, x > !end > > yields : > f951: internal compiler error: free_expr0(): Bad expr type That's obviously an old regression: gcc/4.4.5: pr66451.f:4.27: if ( x(1) < 0 .or. 1 Error: Syntax error in expression at (1) Error: Unexpected end of file in 'pr66451.f' gcc/4.5.2: pr66451.f:4.9: if ( x(1) < 0 .or. 1 Internal Error at (1): free_expr0(): Bad expr type ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/66450] [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function 2015-06-07 15:31 [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function mosra at centrum dot cz 2015-06-08 17:48 ` [Bug c++/66450] " daniel.kruegler at googlemail dot com @ 2015-06-11 15:45 ` jason at gcc dot gnu.org 2015-06-17 14:33 ` jason at gcc dot gnu.org 2015-06-23 15:30 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2015-06-11 15:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Jun 11 15:45:01 2015 New Revision: 224381 URL: https://gcc.gnu.org/viewcvs?rev=224381&root=gcc&view=rev Log: PR c++/66450 * constexpr.c (cxx_eval_store_expression): Avoid messing up outer ctx->ctor. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/66450] [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function 2015-06-07 15:31 [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function mosra at centrum dot cz 2015-06-08 17:48 ` [Bug c++/66450] " daniel.kruegler at googlemail dot com 2015-06-11 15:45 ` jason at gcc dot gnu.org @ 2015-06-17 14:33 ` jason at gcc dot gnu.org 2015-06-23 15:30 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2015-06-17 14:33 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Wed Jun 17 14:33:02 2015 New Revision: 224557 URL: https://gcc.gnu.org/viewcvs?rev=224557&root=gcc&view=rev Log: PR c++/66450 * constexpr.c (cxx_eval_store_expression): Avoid messing up outer ctx->ctor. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C Modified: branches/gcc-5-branch/gcc/cp/ChangeLog branches/gcc-5-branch/gcc/cp/constexpr.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/66450] [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function 2015-06-07 15:31 [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function mosra at centrum dot cz ` (2 preceding siblings ...) 2015-06-17 14:33 ` jason at gcc dot gnu.org @ 2015-06-23 15:30 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2015-06-23 15:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Blocks| |55004 Resolution|--- |FIXED Target Milestone|--- |5.2 --- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> --- Fixed then. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004 [Bug 55004] [meta-bug] constexpr issues ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-23 15:30 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-06-07 15:31 [Bug c++/66450] New: [5 Regression][C++11][constexpr] Issues when delegating implicit copy constructor in constexpr function mosra at centrum dot cz 2015-06-08 17:48 ` [Bug c++/66450] " daniel.kruegler at googlemail dot com 2015-06-11 15:45 ` jason at gcc dot gnu.org 2015-06-17 14:33 ` jason at gcc dot gnu.org 2015-06-23 15:30 ` 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).