[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #12 from Marek Polacek  ---
Ok, fixed.

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-20 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #11 from Volker Reichelt  ---
Hi Marek, thanks for the fix!
However, the ChangeLog entry is wrong.

In the final version you didn't call instantiate_non_dependent_expr_sfinae,
but instantiate_non_dependent_expr instead.

Would you mind fixing that? Thanks!

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #9 from Marek Polacek  ---
Author: mpolacek
Date: Mon Mar 20 15:02:09 2017
New Revision: 246279

URL: https://gcc.gnu.org/viewcvs?rev=246279=gcc=rev
Log:
PR c++/80059 - ICE with noexcept and __transaction_atomic
* except.c (build_must_not_throw_expr): Call
instantiate_non_dependent_expr_sfinae.

* g++.dg/tm/pr80059-2.C: New test.
* g++.dg/tm/pr80059.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/tm/pr80059-2.C
trunk/gcc/testsuite/g++.dg/tm/pr80059.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/except.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Marek Polacek  ---
Fixed.

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #8 from Marek Polacek  ---
Right, I think that's best.  I'm testing it.  Thanks!

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-17 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #7 from Paolo Carlini  ---
Yes. Judging by the comment before fold_non_dependent_expr (which I wrote
myself ;) it seems we could use instantiate_non_dependent_expr_sfinae (cond,
tf_none) instead?

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #6 from Marek Polacek  ---
Actually, it seems weird to call cxx_constant_value after
fold_non_dependent_expr has called maybe_constant_value.  :/

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #5 from Marek Polacek  ---
Yeah, seems fine to me.  Although I don't think we need to check
processing_template_decl before fold_non_dependent_expr.

I'll test and post, thanks.

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-17 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

Paolo Carlini  changed:

   What|Removed |Added

 CC||paolo.carlini at oracle dot com

--- Comment #4 from Paolo Carlini  ---
Sorry about the regression. Marek, what about something like:

Index: except.c
===
--- except.c(revision 246216)
+++ except.c(working copy)
@@ -271,6 +271,8 @@ build_must_not_throw_expr (tree body, tree cond)
   cond = perform_implicit_conversion_flags (boolean_type_node, cond,
tf_warning_or_error,
LOOKUP_NORMAL);
+  if (processing_template_decl)
+   cond = fold_non_dependent_expr (cond);
   cond = cxx_constant_value (cond);
   if (integer_zerop (cond))
return body;

certainly works fine for the testcases at issue and also for variants like:

template int foo(T b)
{
  return __transaction_atomic noexcept(b) (0);
}

void bar()
{
  foo(true);
}

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #3 from Marek Polacek  ---
Ah, no, that's wrong.

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

--- Comment #2 from Marek Polacek  ---
This seems to fix it:

--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -271,7 +271,7 @@ build_must_not_throw_expr (tree body, tree cond)
   cond = perform_implicit_conversion_flags (boolean_type_node, cond,
tf_warning_or_error,
LOOKUP_NORMAL);
-  cond = cxx_constant_value (cond);
+  cond = fold_non_dependent_expr (cond);
   if (integer_zerop (cond))
return body;
   else if (integer_onep (cond))

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-03-16
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Started with r245901.

[Bug c++/80059] [7 Regression] ICE with invalid noexcept for __transaction_atomic

2017-03-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
   Target Milestone|--- |7.0