From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13717 invoked by alias); 28 Jul 2015 12:43:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13632 invoked by uid 48); 28 Jul 2015 12:43:34 -0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90 Date: Tue, 28 Jul 2015 12:43: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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg02447.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64921 --- Comment #24 from Uro=C5=A1 Bizjak --- (In reply to Mikael Morin from comment #22) > (In reply to rguenther@suse.de from comment #21) > > Transfer.4 _is_ null in the case we segfault. So the guard us clearly = wrong. > >=20 > OK, let's try something else. > Are you positive transfer.4 is null? > I don't see anything that would make it so. I can confirm that this patch fixes "Invalid read of size 8" valgrind memory error for gfortran.dg/class_allocate_18.f90. >>From gcc-bugs-return-493558-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 28 13:17:49 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 64661 invoked by alias); 28 Jul 2015 13:17:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 64598 invoked by uid 48); 28 Jul 2015 13:17:44 -0000 From: "anders.granlund.0 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67026] GCC incorrectly rejects well-formed constexpr function definition Date: Tue, 28 Jul 2015 13:17: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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anders.granlund.0 at gmail dot com 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: Message-ID: In-Reply-To: References: 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-07/txt/msg02448.txt.bz2 Content-length: 1697 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67026 --- Comment #3 from Anders Granlund --- (In reply to Andrew Pinski from comment #2) > Actually wait. I think this is invalid and clang is incorrect in not > rejecting it. Because you have a call to a non constexpr in a constexpr > function; does not matter if it is after a return or not. My program is valid. Just having a call expression with a non-constexpr function inside the body of a constexpr function is not in it self a reason for the program to be ill-formed. The c++ standard is quite permissive about what a function body of a constexpr function can contain, see [dcl.constexpr]p3 (http://eel.is/c++draft/dcl.constexpr#3). The program would however be ill-formed with no diagnostics required, if the constexpr function could never be called without calling the non-constexpr function. For details, see [dcl.constexpr]p5 (http://eel.is/c++draft/dcl.constexpr#5). Also the program wold be ill-formed, if the constexpr function needs to be called when evaluating an expression that needs to be a constant expression, and that call would result in a call to the non-constexpr function. For details, see [expr.const]p2 (http://eel.is/c++draft/expr.const#2) (item 2 in the list). I choose the return type void to avoid having to return a value in f. The test case works with int as return type also. void g() {} constexpr int f() { return 0; g(); } int main() {} Anyways GCC supports the return type void for constexpr functions. Also relaxed requirements on constexpr functions have been implemented since version 5 of GCC according to this: https://gcc.gnu.org/projects/cxx1y.html