[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2021-04-14 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

--- Comment #9 from Jason Merrill  ---
Created attachment 50594
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50594=edit
patch for stage 1

A more general, but also more risky, fix for next stage 1.

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2021-04-14 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Jason Merrill  changed:

   What|Removed |Added

Summary|[8/9/10/11 Regression]  |[8/9/10 Regression] Invalid
   |Invalid use of non-static   |use of non-static data
   |data member causes ICE in   |member causes ICE in
   |gimplify_expr   |gimplify_expr
  Known to work||11.0

--- Comment #8 from Jason Merrill  ---
Fixed for 11 so far.

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-04-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-03-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Jason, your thoughts on this?

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-03-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.4 |8.5

--- Comment #5 from Jakub Jelinek  ---
GCC 8.4.0 has been released, adjusting target milestone.

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-02-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Richard Biener  changed:

   What|Removed |Added

   Keywords||accepts-invalid
   Target Milestone|--- |8.4

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-02-07 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

--- Comment #4 from Paolo Carlini  ---
Related to c++/84939

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-01-20 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #3 from rsandifo at gcc dot gnu.org  
---
Hmm, yeah.  Before the patch we silently accepted the code
and generated an unconditional trap for a null dereference,
which doesn't sound right either.  This is because we used
to fold the dummy object pointer (represented using an
INTEGER_CST with void_type) into a normal null pointer.

Where should this be trapped?  The error for accessing
a non-static data member is suppressed for sizeof,
and obviously needs to be for sizeof(S::m):

  /* DR 613/850: Can use non-static data members without an associated
 object in sizeof/decltype/alignof.  */
  if (is_dummy_object (object) && cp_unevaluated_operand == 0
  && (!processing_template_decl || !current_class_ref))

A see-one-play-one fix would be to force cp_unevaluated_operand
to zero while parsing an array dimension, on the basis that the
dimension should either be constant (standard C++) or can be
evaluated (GNU VLAs).  That feels really hackish though...

Should we instead trap this during gimplification?  But then
that would probably make:

   sizeof(char[sizeof(char[S::m])])

valid, which doesn't sound right either.

[Bug c++/93314] [8/9/10 Regression] Invalid use of non-static data member causes ICE in gimplify_expr

2020-01-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org,
   ||rsandifo at gcc dot gnu.org
  Known to work||4.9.4
Summary|Invalid use of non-static   |[8/9/10 Regression] Invalid
   |data member causes ICE in   |use of non-static data
   |gimplify_expr   |member causes ICE in
   ||gimplify_expr
  Known to fail||10.0, 5.0

--- Comment #2 from Martin Sebor  ---
Confirmed.  Bisection points to r210692 committed into 4.10.0:

gcc/
* tree.def (VOID_CST): New.
* tree-core.h (TI_VOID): New.
* tree.h (void_node): New.
* tree.c (tree_node_structure_for_code, tree_code_size)
(iterative_hash_expr): Handle VOID_CST.
(build_common_tree_nodes): Initialize void_node.

gcc/c-family/
* c-common.h (CTI_VOID_ZERO, void_zero_node): Delete.
* c-common.c (c_common_nodes_and_builtins): Don't initialize
void_zero_node.
* c-pretty-print.c (pp_c_void_constant): New function.
(c_pretty_printer::constant, c_pretty_printer::primary_expression)
(c_pretty_printer::expression): Handle VOID_CST.
* cilk.c (extract_free_variables): Likewise.
* c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift)
(ubsan_instrument_vla): Use void_node instead of void_zero_node.

gcc/c/
* c-array-notation.c (expand_array_notations): Use void_node
instead of void_zero_node.

gcc/cp/
* cvt.c (convert_to_void): Use void_node instead of void_zero_node.
* cp-array-notation.c (replace_invariant_exprs): Likewise.
(expand_array_notation): Handle VOID_CST.
* error.c (dump_expr): Likewise.
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression)
(cxx_pretty_printer::expression): Likewise.
(pp_cxx_new_expression): Use void_node instead of void_zero_node.
* decl.c (register_dtor_fn): Likewise.
* init.c (build_raw_new_expr, build_new_1, build_vec_init)
(build_delete, push_base_cleanups): Likewise.
* mangle.c (write_expression): Likewise.
* semantics.c (finish_break_stmt, empty_expr_stmt_p): Likewise.
* pt.c (tsubst_decl, tsubst_copy_and_build): Likewise.
(tsubst, tsubst_copy, build_non_dependent_expr): Handle VOID_CST.
* tree.c (cp_tree_equal): Likewise.
(build_dummy_object, is_dummy_object, stabilize_expr): Use void_node
instead of void_zero_node.
* typeck.c (check_return_expr): Likewise.
* typeck2.c (build_functional_cast): Likewise.