From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 998C9385801F for ; Wed, 14 Feb 2024 17:38:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 998C9385801F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 998C9385801F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707932324; cv=none; b=eIoamGYa/HitwfB7t+CBsSpDv8fscT2WpJQzfNWzTM5YXhnU2jkfstecRSPM5ak+LvGK4tl62RTB14J63xELLQW7hXSjVIS+aRWvh0Xd7pGGAN8LWFUqwkPGzoLPw802gKZ1UDyxV8A+29tZZyB8j6q5zfXhopD3kX0PCP+IUMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707932324; c=relaxed/simple; bh=vgEeZm4GyGcZJjzBiyJa2OqwFKiUnCR6CTbbGC5P3UM=; h=DKIM-Signature:From:Mime-Version:Subject:Date:Message-Id:To; b=pityoe292c8Wpv7HUiEfpStQtl0mIn0p876W3q9YbGmN5QztFY8Hs/oqIChGcYMf7WhoNk9/1QqUrqtqnlLKLE5iycwlnNQExbzOuwNrztu/pR5G1YjIFSh5arYq1bvLJVLjVdH0jSO/0LT5AleqAz2e1DkWp71dUbH0gSXiL4k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-558f523c072so8833545a12.2 for ; Wed, 14 Feb 2024 09:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707932321; x=1708537121; darn=gcc.gnu.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=4BSG6wsmhfozgZrF1pElMem14NHFwon/P3KqSgRVBwU=; b=LfDG2HjvnXAh72/vTQ5ainQDa5GjxvkcYqmUGbgU0V92+Q23eOuLMik2ZmA/QtAWAc NJ6WM2IYipHD531IEE8XYG1yBz7OHb14MEzSoKvddLT+H+SdEd4ldJ4DXUOnLHDCz1Vq zAAglmvjpAxMbcQ7PT0yM6IPocGoHbEZRyMdhRqdGohx17vfhR3VTdxiuTS0STp1mSn/ I0goX27GZOJs+YxDv6rSN0+4CrpJr0zHhXbCh2JIWQgNLNtPtx6w/gvQbmTbhxATe0V0 fH07wox0jT5Ie1P9plamMHVPs1tRFsslP2RGbT2TwllR++DWgEb69fJpEVK6dIVGcxtb Srhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707932321; x=1708537121; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4BSG6wsmhfozgZrF1pElMem14NHFwon/P3KqSgRVBwU=; b=jzXITLLgdl23YObZJLJayYMYfgAFiRni7MJKPaqHqKAlIZ6RAIrpjFw+7NrjczQPX3 KtC0qzdCioH77aLL6JH91z9gYmUJjq4WZ4Z9nLIHjWTJXtqsBD2lf0XATLfYJnLNVJaW QtTF9UDFZi/3SysMosvxfaMLnW8cxnEhpXhyoHFnkZqw4eqqabiFRmflDcgk7BkEKMJG NXJDpi1qJwx0Es3Y5lLQDwwObmwzRpg1/v/+NzPQLQNc+LdrK/slUm3KgRjxyPLlpxkQ 48Kafd6cRnzAuvQdcXYDZjQclu+W4CYZuw2eBL5Fb9D91sclkgQBCfPsdU8D7wtyWqSL L32Q== X-Gm-Message-State: AOJu0YxbcI5iQgTL1F6NeHt+6i3PXazol1ATkUT7UzPdYajUmmuH+TEG X2535dFUElYnUIFQdXpqOGDBMlIcsmdIM2916sOMnssPvcmQ5l93 X-Google-Smtp-Source: AGHT+IE3QmaVVqiwiT4c+pOD5OEOZl7EgpBMPIduEDbdxny1fbblp+lIQii+osImsfCkaf49ubhR0Q== X-Received: by 2002:aa7:ccc7:0:b0:562:1806:448f with SMTP id y7-20020aa7ccc7000000b005621806448fmr2888802edt.3.1707932320866; Wed, 14 Feb 2024 09:38:40 -0800 (PST) Received: from smtpclient.apple (dynamic-077-009-001-073.77.9.pool.telefonica.de. [77.9.1.73]) by smtp.gmail.com with ESMTPSA id h9-20020a0564020e0900b0056058f2603asm4942053edh.3.2024.02.14.09.38.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 09:38:38 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: Valid types for a binary op in GENERIC? Date: Wed, 14 Feb 2024 18:38:28 +0100 Message-Id: References: <00d59a6db28ba37be5742d0718f7856fd99d0a3a.camel@redhat.com> Cc: gcc@gcc.gnu.org In-Reply-To: <00d59a6db28ba37be5742d0718f7856fd99d0a3a.camel@redhat.com> To: David Malcolm X-Mailer: iPhone Mail (21D61) X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Am 14.02.2024 um 18:16 schrieb David Malcolm via Gcc : >=20 > =EF=BB=BFThe ICE in PR analyzer/111441 is due to this assertion in > fold_binary_loc failing: >=20 > 11722 gcc_assert (TYPE_PRECISION (atype) =3D=3D TYPE_PRECISIO= N (type)); >=20 > where code=3DMULT_EXPR, type=3D, and: >=20 > (gdb) p type > $1 =3D > (gdb) p atype > $2 =3D >=20 > due to the analyzer building a mult_expr node with those types for the > arguments. >=20 > I have a fix for this (by adding some missing casts within the > analyzer's svalue representation), but it got me wondering: is there a > way to check valid types for binary operations in GENERIC? >=20 > Looking at > https://gcc.gnu.org/onlinedocs/gccint/Unary-and-Binary-Expressions.html > I see that for PLUS_EXPR, MINUS_EXPR and MULT_EXPR their "operands may > have either integral or floating type, but there will never be [sic] > case in which one operand is of floating type and the other is of > integral type." >=20 > Is it the case that for PLUS_EXPR, MINUS_EXPR and MULT_EXPR, their > arguments *must* have the same precision? Or that types_compatible_p > is true? What about other binary operations? >=20 > FWIW I currently have this hacked-up assertion in my working copy: >=20 > const svalue * > region_model_manager::get_or_create_binop (tree type, enum tree_code op, > const svalue *arg0, > const svalue *arg1) > { > if (arg0->get_type () > && arg1->get_type () > && op !=3D POINTER_PLUS_EXPR) > { > // FIXME: what ops does this apply to? MULT_EXPR? > gcc_assert (types_compatible_p (arg0->get_type (), arg1->get_type ())= ); > } >=20 >=20 > Is there a function to check type-compatibility of the args given a > particular enum tree_code? No. The best source is the GIMPLE verifier in tree-cfg.cc > Sorry if I'm missing something here > Dave >=20