[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-23 Thread Woebbeking at web dot de

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895

André Wöbbeking Woebbeking at web dot de changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #17 from André Wöbbeking Woebbeking at web dot de 2013-04-23 
08:07:27 UTC ---
Thanks!

[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-14 Thread Woebbeking at web dot de

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895

--- Comment #16 from André Wöbbeking Woebbeking at web dot de 2013-04-14 
14:15:47 UTC ---
Thanks for your fast support!

[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-12 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED



--- Comment #15 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-12 
09:14:41 UTC ---

Author: jakub

Date: Thu Apr 11 19:42:33 2013

New Revision: 197824



URL: http://gcc.gnu.org/viewcvs?rev=197824root=gccview=rev

Log:

PR c++/56895

* call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before

calling maybe_constant_value for C++98.



* g++.dg/template/arrow4.C: New test.



Added:

trunk/gcc/testsuite/g++.dg/template/arrow4.C

Modified:

trunk/gcc/cp/ChangeLog

trunk/gcc/cp/call.c

trunk/gcc/testsuite/ChangeLog



Author: jakub

Date: Thu Apr 11 19:43:58 2013

New Revision: 197825



URL: http://gcc.gnu.org/viewcvs?rev=197825root=gccview=rev

Log:

PR c++/56895

* call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before

calling maybe_constant_value for C++98.



* g++.dg/template/arrow4.C: New test.



Added:

branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/arrow4.C

Modified:

branches/gcc-4_8-branch/gcc/cp/ChangeLog

branches/gcc-4_8-branch/gcc/cp/call.c

branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-11 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|RESOLVED|ASSIGNED

 Resolution|FIXED   |

 AssignedTo|unassigned at gcc dot   |jakub at gcc dot gnu.org

   |gnu.org |



--- Comment #14 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-11 
08:00:05 UTC ---

Created attachment 29853

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29853

gcc49-pr56895-2.patch



Untested fix.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-10 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 Resolution||FIXED



--- Comment #11 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-10 
06:54:28 UTC ---

Author: jakub

Date: Wed Apr 10 06:33:26 2013

New Revision: 197660



URL: http://gcc.gnu.org/viewcvs?rev=197660root=gccview=rev

Log:

PR c++/56895

* typeck.c (cp_build_binary_op): Call fold_non_dependent_expr_sfinae

first before calling maybe_constant_value for warn_for_div_by_zero

or invalid shift count warning purposes.



* g++.dg/template/arrow3.C: New test.



Added:

trunk/gcc/testsuite/g++.dg/template/arrow3.C

Modified:

trunk/gcc/cp/ChangeLog

trunk/gcc/cp/typeck.c

trunk/gcc/testsuite/ChangeLog



Author: jakub

Date: Wed Apr 10 06:37:07 2013

New Revision: 197662



URL: http://gcc.gnu.org/viewcvs?rev=197662root=gccview=rev

Log:

PR c++/56895

* typeck.c (cp_build_binary_op): Call fold_non_dependent_expr_sfinae

first before calling maybe_constant_value for warn_for_div_by_zero

or invalid shift count warning purposes.



* g++.dg/template/arrow3.C: New test.



Added:

branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/arrow3.C

Modified:

branches/gcc-4_8-branch/gcc/cp/ChangeLog

branches/gcc-4_8-branch/gcc/cp/typeck.c

branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-10 Thread markus at trippelsdorf dot de

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895

--- Comment #12 from Markus Trippelsdorf markus at trippelsdorf dot de 
2013-04-10 19:56:00 UTC ---
Just double checked and the original testcase still ICEs.

markus@x4 tmp % cat test.cpp
#include iostream
extern struct A { bool foo (); A bar (); } *a;
template class 
void
fn1 ()
{
  std::cout  (a-bar().foo() ? 1 : 0);
}

markus@x4 tmp % c++ -c test.cpp
test.cpp: In function ‘void fn1()’:
test.cpp:7:39: internal compiler error: unexpected expression ‘a-’ of kind
arrow_expr

[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-10 Thread markus at trippelsdorf dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #13 from Markus Trippelsdorf markus at trippelsdorf dot de 
2013-04-10 20:04:03 UTC ---

struct B

{

void operator (B ());

void operator (int);

};

B b;

struct A

{

bool foo ();

A bar ();

};

A *a;

template class

void

fn1 ()

{

b  (a-bar().foo() ? : 0);

}


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



Paolo Carlini paolo.carlini at oracle dot com changed:



   What|Removed |Added



 Status|UNCONFIRMED |NEW

   Last reconfirmed||2013-04-09

Summary|ICE: unexpected expression  |[4.8/4.9 Regression] ICE:

   |of kind arrow_expr  |unexpected expression of

   ||kind arrow_expr

 Ever Confirmed|0   |1



--- Comment #2 from Paolo Carlini paolo.carlini at oracle dot com 2013-04-09 
16:20:16 UTC ---

Confirmed.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 CC||jakub at gcc dot gnu.org,

   ||jason at gcc dot gnu.org

   Target Milestone|--- |4.8.1



--- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
17:54:16 UTC ---

Introduced by my http://gcc.gnu.org/r195051 , potential_constant_expression

returns true about it, because fun in a call expr isn't a FUNCTION_DECL.

Jason, can you look at whether this is something that should be changed in

potential_constant_expression, or instead in cxx_eval_const* ?


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jason at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #4 from Jason Merrill jason at gcc dot gnu.org 2013-04-09 
18:03:47 UTC ---

(In reply to comment #3)

 Introduced by my http://gcc.gnu.org/r195051 , potential_constant_expression

 returns true about it, because fun in a call expr isn't a FUNCTION_DECL.

 Jason, can you look at whether this is something that should be changed in

 potential_constant_expression, or instead in cxx_eval_const* ?



The problem is that we're passing an expression to maybe_constant_value that

hasn't yet been through fold_non_dependent_expr.  Either we need to call that

first or disable this checking in templates.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
18:15:51 UTC ---

So:

@@ -4178,7 +4178,8 @@ cp_build_binary_op (location_t location,

 }

   else if (code0 == INTEGER_TYPE  code1 == INTEGER_TYPE)

 {

-  tree const_op1 = maybe_constant_value (op1);

+  tree const_op1 = fold_non_dependent_expr_sfinae (op1, tf_none);

+  const_op1 = maybe_constant_value (const_op1);

   if (TREE_CODE (const_op1) != INTEGER_CST)

 const_op1 = op1;

   result_type = type0;



?  Seems to work on this testcase.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #6 from Paolo Carlini paolo.carlini at oracle dot com 2013-04-09 
18:33:26 UTC ---

It seems a bit weird not propagating complain..


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
18:36:41 UTC ---

The reason for that is that I don't want errors being printed just when trying

to optimize to see if I should warn or not.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #8 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
18:37:36 UTC ---

Though, there are several other maybe_constant_value calls now in cp/typeck.c,

and only 2 of them are guarded with !processing_template_decl.

So I guess the warn_for_div_by_zero argument (twice) and

RSHIFT_EXPR/LSHIFT_EXPR would need the same treatment.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #9 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
18:46:16 UTC ---

Created attachment 29844

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29844

gcc49-pr56895.patch



Untested complete patch.


[Bug c++/56895] [4.8/4.9 Regression] ICE: unexpected expression of kind arrow_expr

2013-04-09 Thread jason at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56895



--- Comment #10 from Jason Merrill jason at gcc dot gnu.org 2013-04-09 
18:49:28 UTC ---

OK.