public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65075] New: [5 Regression] constexpr regression
@ 2015-02-16  0:34 jakub at gcc dot gnu.org
  2015-02-16  0:35 ` [Bug c++/65075] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-16  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65075
           Summary: [5 Regression] constexpr regression
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org

typedef void (*E) ();
template <class T>
constexpr E
bar ()
{
  return []() {};
}
void
foo ()
{
  (bar<int> ()) ();
}

is rejected since r215954 aka PR55250 with -std=c++11:
error: body of constexpr function ‘constexpr void (* bar())() [with T = int; E
= void (*)()]’ not a return-statement
The body is a return statement, just perhaps with some extra artificial
statements created for the lambda.
>From gcc-bugs-return-477349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Feb 16 00:34:42 2015
Return-Path: <gcc-bugs-return-477349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16311 invoked by alias); 16 Feb 2015 00:34:41 -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 16266 invoked by uid 48); 16 Feb 2015 00:34:37 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/64992] More optimize opportunity
Date: Mon, 16 Feb 2015 00:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
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: bug_status
Message-ID: <bug-64992-4-WvBpr2IFi9@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64992-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64992-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-02/txt/msg01682.txt.bz2
Content-length: 714

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
We do not sink the code that computes d into the branch c==-1. If we did, the
second comparison would simplify to a constant. VRP is not clever enough to
"backport" new assertions to already computed values.

We could also simplify N*x==0 to x==0 even for unsigned when VRP information
tells us that overflow/wrap cannot happen (here N is 2 and x is in [0,1]).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
@ 2015-02-16  0:35 ` jakub at gcc dot gnu.org
  2015-02-16 10:18 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-16  0:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-16
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo at gcc dot gnu.org
   Target Milestone|---                         |5.0
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
  2015-02-16  0:35 ` [Bug c++/65075] " jakub at gcc dot gnu.org
@ 2015-02-16 10:18 ` rguenth at gcc dot gnu.org
  2015-02-16 13:56 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-16 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
  2015-02-16  0:35 ` [Bug c++/65075] " jakub at gcc dot gnu.org
  2015-02-16 10:18 ` rguenth at gcc dot gnu.org
@ 2015-02-16 13:56 ` paolo.carlini at oracle dot com
  2015-02-16 13:59 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-02-16 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Hi Jakub. Something like the below passes testing and works for the testcase:

Index: constexpr.c
===================================================================
--- constexpr.c    (revision 220731)
+++ constexpr.c    (working copy)
@@ -415,8 +415,8 @@ check_constexpr_bind_expr_vars (tree t)
   gcc_assert (TREE_CODE (t) == BIND_EXPR);

   for (tree var = BIND_EXPR_VARS (t); var; var = DECL_CHAIN (var))
-    if (TREE_CODE (var) == TYPE_DECL
-    && DECL_IMPLICIT_TYPEDEF_P (var))
+    if (DECL_IMPLICIT_TYPEDEF_P (var)
+    && !LAMBDA_TYPE_P (TREE_TYPE (var)))
       return false;
   return true;
 }

Note that I will be traveling for a week or so, thus I'm not be able to fully
handle the issue. If we rather resolve the regression immediately, please feel
free to pick up the above / double check if it makes sense to Jason.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-02-16 13:56 ` paolo.carlini at oracle dot com
@ 2015-02-16 13:59 ` jakub at gcc dot gnu.org
  2015-02-17  8:26 ` jakub at gcc dot gnu.org
  2015-02-17  8:33 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-16 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, makes sense, I've just been looking for what the flag is for the lambda
types.  I can add the testcase and bootstrap/regtest it.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-02-16 13:59 ` jakub at gcc dot gnu.org
@ 2015-02-17  8:26 ` jakub at gcc dot gnu.org
  2015-02-17  8:33 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-17  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Feb 17 08:25:30 2015
New Revision: 220748

URL: https://gcc.gnu.org/viewcvs?rev=220748&root=gcc&view=rev
Log:
    PR c++/65075
    * constexpr.c (check_constexpr_bind_expr_vars): Allow
    implicit typedefs for lambda types.

    * g++.dg/cpp0x/pr65075.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr65075.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/65075] [5 Regression] constexpr regression
  2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-17  8:26 ` jakub at gcc dot gnu.org
@ 2015-02-17  8:33 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-17  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-17  8:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16  0:34 [Bug c++/65075] New: [5 Regression] constexpr regression jakub at gcc dot gnu.org
2015-02-16  0:35 ` [Bug c++/65075] " jakub at gcc dot gnu.org
2015-02-16 10:18 ` rguenth at gcc dot gnu.org
2015-02-16 13:56 ` paolo.carlini at oracle dot com
2015-02-16 13:59 ` jakub at gcc dot gnu.org
2015-02-17  8:26 ` jakub at gcc dot gnu.org
2015-02-17  8:33 ` 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).