https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111922
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com, | |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Slightly cleaned up: void f2 (void); void f4 (int, int, int); struct A { int a; }; struct B { struct A *b; int c; } v; static int f1 (x, y) struct C *x; struct A *y; { (v.c = v.b->a) || (v.c = v.b->a); f2 (); } static void f3 (int x, int y) { int b = f1 (0, ~x); f4 (0, 0, v.c); } void f5 (void) { f3 (0, 0); } The problem is in the f1 call, given it uses the K&R definition style and the caller invokes UB by using incompatible types (int vs. pointers), I think IPA-VRP should punt somewhere on the type mismatch. I think Value_Range vr (operand_type); if (TREE_CODE_CLASS (operation) == tcc_unary) ipa_vr_operation_and_type_effects (vr, src_lats->m_value_range.m_vr, operation, param_type, operand_type); should be avoided if param_type is not a compatible type to operand_type, unless operation is some cast operation (NOP_EXPR, CONVERT_EXPR, dunno if the float to integral or vice versa ops as well but vrp probably doesn't handle that yet). In the above case, param_type is struct A *, i.e. pointer, while operand_type is int.