From patchwork Wed Oct 16 12:17:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1997992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g7G1h7jr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XT93h3XwSz1xv6 for ; Wed, 16 Oct 2024 23:18:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70551385780C for ; Wed, 16 Oct 2024 12:18:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 7DDED3858429 for ; Wed, 16 Oct 2024 12:17:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DDED3858429 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 7DDED3858429 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=1729081075; cv=none; b=aFfMWG2Oiq8MH9H4KjkMJYPx2y1DJEGLbwSv++CQZA8b8jvkQM/NUxtt1P/EThPk+YaInkb/TKH5S8m/qBD9GDAkTPM7tggcRXcsBHu7dJFOdYJV+Uo8bumQ/6gD0uAw/oonHIZn6iz/FRdfczhLgLCsVD1GKubSIXXi0f+AH00= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729081075; c=relaxed/simple; bh=p+EhudBYxE+Y77Y2F70DythazoguPDCwW8OP+dMsgus=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=VUBQkDtO59Y3PV6E3QpXft+z3P+NuL4pFuwBDnH8XqWOMzhs7IH+uvgY5EP/GN5B11sHjy4g96T7xFQ2JgsHd9dxF5p7Eld46AONroVO13JegJC3jrY6JNzkh9EJVGCVqobYKn5DGcP81B9+78u1jabQSvDPv5HpFdnEOGsKjTk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729081065; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=bmgHwJMFp6Bc4HgY/gdqC14gpGiF+B8wBRT+jdQ6Ue4=; b=g7G1h7jrnwXDmzIu++N9pXIoV3CWK+sd2x2s+2P7S2Tgq0HDFACivNwScLF9K1Qf2yRbUL 19W2CHhYKkt4dZD8ZmaEadkQFpLdcrFa+mP4hZUCOiumK+PcwgiGOmnl5s/wXzAYS3ScNA EtysjAyz48sGrc0Yc7bdO7pXM3pJP94= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-438-BVmCO4-bNIC03Z9IemmoJw-1; Wed, 16 Oct 2024 08:17:41 -0400 X-MC-Unique: BVmCO4-bNIC03Z9IemmoJw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 26B631956096 for ; Wed, 16 Oct 2024 12:17:40 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 54C911956056; Wed, 16 Oct 2024 12:17:39 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 49GCHaLY1583160 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 16 Oct 2024 14:17:36 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 49GCHaGG1583158; Wed, 16 Oct 2024 14:17:36 +0200 Date: Wed, 16 Oct 2024 14:17:36 +0200 From: Jakub Jelinek To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] c: Fix up uninitialized next.original_type use in #embed optimization Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Jonathan pointed me at a diagnostic from an unnamed static analyzer which found that next.original_type isn't initialized for the CPP_EMBED case when it is parsed in a comma expression, yet expr.original_type = next.original_type; is done a few lines later and the expr is returned. Fixed thusly, tested on x86_64-linux, ok for trunk? 2024-10-16 Jakub Jelinek * c-parser.cc (c_parser_expression): Initialize next.original_type to integer_type_node for the CPP_EMBED case. Jakub --- gcc/c/c-parser.cc.jj 2024-10-16 10:32:27.000000000 +0200 +++ gcc/c/c-parser.cc 2024-10-16 14:09:44.393913829 +0200 @@ -13299,6 +13299,7 @@ c_parser_expression (c_parser *parser) next.value = build_int_cst (TREE_TYPE (val), ((const unsigned char *) RAW_DATA_POINTER (val))[last]); + next.original_type = integer_type_node; c_parser_consume_token (parser); } else