public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-64921-4-cjtheeUrSB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64921-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64921

--- Comment #24 from Uroš Bizjak <ubizjak at gmail dot com> ---
(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.
> > 
> 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: <gcc-bugs-return-493558-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <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 64598 invoked by uid 48); 28 Jul 2015 13:17:44 -0000
From: "anders.granlund.0 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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: <bug-67026-4-raybog8UrS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67026-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67026-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-07/txt/msg02448.txt.bz2
Content-length: 1697

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg026

--- Comment #3 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(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


  parent reply	other threads:[~2015-07-28 12:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 15:42 [Bug rtl-optimization/64921] New: [5 Regression] FAIL: gfortran.dg/class_allocate_18.f90 with -fPIC hjl.tools at gmail dot com
2015-02-03 16:03 ` [Bug rtl-optimization/64921] " jakub at gcc dot gnu.org
2015-02-03 17:22 ` hjl.tools at gmail dot com
2015-02-03 17:32 ` [Bug rtl-optimization/64921] [4.9/5 Regression] FAIL: gfortran.dg/class_allocate_18.f90 hjl.tools at gmail dot com
2015-02-03 21:30 ` pault at gcc dot gnu.org
2015-02-04  3:00 ` ramana at gcc dot gnu.org
2015-02-04 18:21 ` pault at gcc dot gnu.org
2015-02-04 18:31 ` hjl.tools at gmail dot com
2015-02-04 19:00 ` dominiq at lps dot ens.fr
2015-02-04 19:03 ` dominiq at lps dot ens.fr
2015-02-09  0:07 ` pinskia at gcc dot gnu.org
2015-02-09 10:00 ` rguenth at gcc dot gnu.org
2015-02-09 14:26 ` rguenth at gcc dot gnu.org
2015-02-16 13:40 ` dominiq at lps dot ens.fr
2015-02-16 13:48 ` [Bug fortran/64921] " dominiq at lps dot ens.fr
2015-04-27 12:26 ` [Bug fortran/64921] [4.9/5/6 " mathewc at nag dot co.uk
2015-06-26 20:04 ` jakub at gcc dot gnu.org
2015-06-26 20:34 ` jakub at gcc dot gnu.org
2015-07-07 15:29 ` ktkachov at gcc dot gnu.org
2015-07-25 13:31 ` ubizjak at gmail dot com
2015-07-25 15:13 ` ubizjak at gmail dot com
2015-07-27  7:57 ` rguenth at gcc dot gnu.org
2015-07-27 18:45 ` mikael at gcc dot gnu.org
2015-07-27 19:44 ` rguenther at suse dot de
2015-07-28 12:07 ` mikael at gcc dot gnu.org
2015-07-28 12:31 ` rguenther at suse dot de
2015-07-28 12:43 ` ubizjak at gmail dot com [this message]
2015-08-05 15:42 ` mikael at gcc dot gnu.org
2015-08-05 16:42 ` mikael at gcc dot gnu.org
2015-08-05 17:04 ` mikael at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-64921-4-cjtheeUrSB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).