[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

--- Comment #6 from rguenther at suse dot de rguenther at suse dot de ---
On Wed, 20 May 2015, jakub at gcc dot gnu.org wrote:

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211
 
 --- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org ---
 Perhaps just guard this particular match.pd pattern with GIMPLE guard for now
 (until the delayed C++ folding is committed)?

Will try.


[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-05-20
 CC||jakub at gcc dot gnu.org
   Target Milestone|--- |5.2
Summary|Rvalue conversion in|[5/6 Regression] Rvalue
   |ternary operator causes |conversion in ternary
   |internal compiler error |operator causes internal
   ||compiler error
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
Started with r217279.


[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org ---
I will have a look.


[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

--- Comment #3 from Richard Biener rguenth at gcc dot gnu.org ---
So we fold (and did fold before) 1  0 ? x : y to (float) x (thus an rvalue).
Then later we call ocp_convert on that requesting a conversion to int which
does

810   converted = fold_if_not_in_template (convert_to_integer (type,
e));

where convert_to_integer ends up just doing

910 return build1 (FIX_TRUNC_EXPR, type, expr);

and fold then applying the simplification

   /* If we are converting an integer to a floating-point that can
  represent it exactly and back to an integer, we can skip the
  floating-point conversion.  */
   (if (inside_int  inter_float  final_int 
(unsigned) significand_size (TYPE_MODE (inter_type))
= inside_prec - !inside_unsignedp)
(convert @0))

and

(for cvt (convert view_convert float fix_trunc)
 (simplify
  (cvt @0)
  (if ((GIMPLE  useless_type_conversion_p (type, TREE_TYPE (@0)))
   || (GENERIC  type == TREE_TYPE (@0)))
   @0)))

where wrapping the result as (non_lvalue @0) fixes the regression.  The bug
is of course the C++ frontend folding stuff too early (and too aggressive)
here.

But for GCC 5 the above might be a good-enough workaround (eventually
we can conditionalize building non_lvalue exprs to non-C-frontends).


[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jason at redhat dot com
Version|unknown |5.1.0

--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org ---
Unfortunately this causes

FAIL: gcc.dg/tree-ssa/foldcast-1.c scan-tree-dump-times original return x; 2
FAIL: gcc.dg/tree-ssa/pr31261.c scan-tree-dump-times original return b  7; 1

FAIL: gfortran.dg/assumed_type_2.f90   -O0   scan-tree-dump-times original
sub_
scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -O1   scan-tree-dump-times original
sub_
scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -O2   scan-tree-dump-times original
sub_
scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -O3 -fomit-frame-pointer  
scan-tree-dump
-times original sub_scalar .(struct t1 .)
array_class_t1_ptr._data.dat
 1
FAIL: gfortran.dg/assumed_type_2.f90   -O3 -fomit-frame-pointer
-funroll-all-loo
ps -finline-functions   scan-tree-dump-times original sub_scalar .(struct
t
1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -O3 -fomit-frame-pointer -funroll-loops  
 scan-tree-dump-times original sub_scalar .(struct t1 .)
array_class_t1
_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -O3 -g   scan-tree-dump-times original
s
ub_scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/assumed_type_2.f90   -Os   scan-tree-dump-times original
sub_
scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: gfortran.dg/c_f_pointer_tests_3.f90   -O   scan-tree-dump-times original

 fptr_array.data = cptr; 1
FAIL: gfortran.dg/c_loc_test_22.f90   -O   scan-tree-dump-times original
D.[0-9
]+ = parm.[0-9]+.data;[^;]+ptr[1-4] = D.[0-9]+; 4
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O0   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O0   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O1   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O1   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O2   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O2   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer  
scan-tree-dump
-times original fgsl_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer  
scan-tree-dump
-times original fgsl_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer
-funroll-all-loo
ps -finline-functions   scan-tree-dump-times original
fgsl_file.[0-9]+.gsl_file
 = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer
-funroll-all-loo
ps -finline-functions   scan-tree-dump-times original
fgsl_file.[0-9]+.gsl_func
 = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer -funroll-loops  
 scan-tree-dump-times original fgsl_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -fomit-frame-pointer -funroll-loops  
 scan-tree-dump-times original fgsl_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -g   scan-tree-dump-times original
f
gsl_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -O3 -g   scan-tree-dump-times original
f
gsl_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -Os   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_14.f90   -Os   scan-tree-dump-times original
fgsl
_file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_15.f90   -O   scan-tree-dump-times original
fgsl_
file.[0-9]+.gsl_file = c_ptr.[0-9]+; 1
FAIL: gfortran.dg/c_ptr_tests_15.f90   -O   scan-tree-dump-times original
fgsl_
file.[0-9]+.gsl_func = c_funptr.[0-9]+; 1
FAIL: gfortran.dg/coarray_31.f90   -O   scan-tree-dump original
a.y.d._data.dat
a = D.[0-9]+.y.d._data.data;
FAIL: gfortran.dg/coarray_31.f90   -O   scan-tree-dump original a.y.x.data =
D.
[0-9]+.y.x.data;
FAIL: gfortran.dg/coarray_31.f90   -O   scan-tree-dump original
a.y.z._data.dat
a = D.[0-9]+.y.z._data.data;
FAIL: gfortran.dg/no_arg_check_2.f90   -O0   scan-tree-dump-times original
sub_
scalar .(struct t1 .) array_class_t1_ptr._data.dat 1
FAIL: 

[Bug c++/66211] [5/6 Regression] Rvalue conversion in ternary operator causes internal compiler error

2015-05-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66211

--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org ---
Perhaps just guard this particular match.pd pattern with GIMPLE guard for now
(until the delayed C++ folding is committed)?