public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/111922] [11/12/13/14 Regression] ICE in cp with -O2 -fno-tree-fre
Date: Wed, 22 Nov 2023 14:27:14 +0000	[thread overview]
Message-ID: <bug-111922-4-vSYRB3A21y@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111922-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2023-11-22 14:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 16:38 [Bug c/111922] New: GCC: internal compiler error: in decompose, at wide-int.h:1049 141242068 at smail dot nju.edu.cn
2023-10-22 16:39 ` [Bug c/111922] " 141242068 at smail dot nju.edu.cn
2023-10-22 16:41 ` [Bug ipa/111922] [11/12/13/14 Regression] ICE in cp with -O2 -fno-tree-fre pinskia at gcc dot gnu.org
2023-10-23 16:51 ` jamborm at gcc dot gnu.org
2023-11-22 14:27 ` jakub at gcc dot gnu.org [this message]
2023-11-22 16:25 ` amacleod at redhat dot com
2023-11-22 16:32 ` jakub at gcc dot gnu.org
2023-11-22 17:29 ` amacleod at redhat dot com
2023-11-22 17:34 ` jakub at gcc dot gnu.org
2023-11-22 17:42 ` amacleod at redhat dot com
2023-11-29 16:51 ` cvs-commit at gcc dot gnu.org
2023-11-29 16:52 ` amacleod at redhat dot com
2023-11-29 23:22 ` sjames at gcc dot gnu.org
2023-11-30 18:31 ` amacleod at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111922-4-vSYRB3A21y@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).