From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3FD6A385E452 for ; Wed, 14 Feb 2024 17:14:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FD6A385E452 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FD6A385E452 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707930860; cv=none; b=giBOObc9IeZhV+DvfsxKeSVYAH6c2s8E04ngeJpe/hGLI+a82zcutcZoRJHA2FhWfNweaBmHhsJhe4cuknmhDT1Wb6fDi87ikmdFEX39hTydomFaTwczoacAdbhF7YaGNokmGlYOfbRwRj5bdnIQ6lYcZS7ojCRpKLpS8cMyuoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707930860; c=relaxed/simple; bh=X9FGHskFkCBgSpleiuE44C3iH1/EZqf/ue003+hbWDk=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=wAnk0ku85L6NXXbZjMW7AUiLIeeA7YWwpmRX/0VmBEnIgfAUp4xwBmej2rPo/Sp15QUrAgcdvZjonukAzkyBHZ2bpLZ+VJ/WwslIUhFwdPKv6LFE6+Rdbr2FqKKLwvQf7KieGIYmMjV9IM2X3QZFzVxIYxYv69pVxPwMzzfRAkU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707930857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O9Couec3GLIybNpq2okBzhJjnM9MYAr0EMnzZxiluOA=; b=ZhvaJGYURVMyfu+54WW3jcFmRns+oEBWFfnNRqKknxkuwnaLZCdrkXbD/T7QhyB80PShRZ 7PaaHJXmTkGdxT9/FFv3L9dKq00FlkihB9Dt83llXAb9MEA/JZarFRBR2ohyJOIFNOlejl zWudk7HItvT7nm91AMcHo79wV2S2Ick= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-oa9t8_y0MK2Uag_9ZaKzgA-1; Wed, 14 Feb 2024 12:14:16 -0500 X-MC-Unique: oa9t8_y0MK2Uag_9ZaKzgA-1 Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-3c0420d5357so15915b6e.1 for ; Wed, 14 Feb 2024 09:14:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707930855; x=1708535655; h=mime-version:user-agent:content-transfer-encoding:date:to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lCwthzOkTAgHDlhhh/WJtSJH3py2o+/oZcpPnlcUYAA=; b=jI84F95Y8CJVn3yGPqj/xibS32SlzhclfmY/wCdF+Qj1SoyCiE1WjeaEHWErkL/xCd Nko9zprOZxY4o9z4xkm8aqtRAKVThufyaP8so9D1UZyG1LxJnnfI4n/l+1lssflNnDk3 ThVxivld72z0opPOnpEdj2FPnjLexBk2X3jvWi7oJYQMM4WIHakvxCRys95GpqtohvBd ITRp1tCk/bTbm+Pbi/rIIMj/gfDNuu2ssq2dbEqVZ0wXw4duWRBTBdjwMVumhBCR6ubw 0z9lb5qSKeCS/NdhZxBoZoVkRrvbfhCs27NEbaJi/lCsw69FGMSxOOds5LAek5um2aer VeNw== X-Gm-Message-State: AOJu0Yyouao4i2HrupDhXrt6Gx7rGquIezrQbtsMC9EyZX7+PyS5+Bvv kEnm7k7LQK/XvItSCvIqpJkMwbjE8YrpSE9kDObnHrElAgPAUAiOcBuqmqXTCOZoIafKCJwtznS o4UKpRf31AdX0Zi8zYi7/F3sZ1t+xwk8oWikjCoWm1Nt7JsXQxjUcro1fIwnMH5G95RlRw4VvTm bP0xe4RsaTSYttwQk8pqJ/xsH83e9K X-Received: by 2002:a05:6808:3090:b0:3c1:333e:683b with SMTP id bl16-20020a056808309000b003c1333e683bmr1163995oib.20.1707930855652; Wed, 14 Feb 2024 09:14:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/L8jVRzcXIlEWAHVCDLWsYfpqdq8ugS0OhK9rYnVoIoF4idcQ+YhPfxrJAUCcpv/REJ7Ihg== X-Received: by 2002:a05:6808:3090:b0:3c1:333e:683b with SMTP id bl16-20020a056808309000b003c1333e683bmr1163974oib.20.1707930855192; Wed, 14 Feb 2024 09:14:15 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id n16-20020a0ce950000000b0068f07929ae6sm463343qvo.144.2024.02.14.09.14.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 09:14:14 -0800 (PST) Message-ID: <00d59a6db28ba37be5742d0718f7856fd99d0a3a.camel@redhat.com> Subject: Valid types for a binary op in GENERIC? From: David Malcolm To: gcc@gcc.gnu.org Date: Wed, 14 Feb 2024 12:14:13 -0500 User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The ICE in PR analyzer/111441 is due to this assertion in fold_binary_loc failing: 11722=09=09 gcc_assert (TYPE_PRECISION (atype) =3D=3D TYPE_PRECISION (= type)); where code=3DMULT_EXPR, type=3D, and: (gdb) p type $1 =3D (gdb) p atype $2 =3D due to the analyzer building a mult_expr node with those types for the arguments. 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? 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." 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? FWIW I currently have this hacked-up assertion in my working copy: const svalue * region_model_manager::get_or_create_binop (tree type, enum tree_code op, =09=09=09=09=09 const svalue *arg0, =09=09=09=09=09 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 ())= ); } Is there a function to check type-compatibility of the args given a particular enum tree_code? Sorry if I'm missing something here Dave