This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-30 09:42 -------
While my patch is to the middle-end, the C++ frontend part causing this is

build_x_conditional_expr
...
  expr = build_conditional_expr (ifexp, op1, op2);
  if (processing_template_decl && expr != error_mark_node)
    return build_min_non_dep (COND_EXPR, expr,
                              orig_ifexp, orig_op1, orig_op2);

where in the case of a template decl, the valid expr i != 0 ? 0 : i is
thrown away and rebuilt as i ? 0 : i, where the default conversion is no
longer applied.  That could be fixed using perform_implicit_conversion
(boolean_type_node, orig_ifexp) - but I don't know if that would succeed
in case of i being a template param.  We use this (potentially dependent)
expr later to create a non-dependent expr where we fail to apply the
default conversion, too, in

pt.c:build_non_dependent_expr

we could fix that there, too, performing default conversion if the type
is not correct.  And later in

typeck.c:build_array_ref

we happen to call fold on the invalid(?) COND_EXPR.

Of course I'm a lot less confident on the C++ fix than on the fold one.

-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]