From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 713253858C52 for ; Thu, 19 Jan 2023 09:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 713253858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 523065C8BB; Thu, 19 Jan 2023 09:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674121569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=8B3MdrHUz0RecqhJfRxp5L+P9flZJ6EGBzL86+1w7vs=; b=2Hby86BAOFdjleDe4l7OKrmEzG/WG0FCiYT5hJAwyGK2sq8qxvsHyE9jWMRTGIbRncqUf9 trLQUcjrgMkXlST0wHlBKjrog2yd34198vbC4DTAm8qQVdzpXXfHJ+GB7cnrOtZ0R50+25 BiDdcxkchBN7IOL5FYyjChw3nQaPCoU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674121569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=8B3MdrHUz0RecqhJfRxp5L+P9flZJ6EGBzL86+1w7vs=; b=rA8sXT++kXR8RjQBZ4tz/Ekci70UbSBwq0LW6/w66cdjkWVIHDulMAcI1uk89hTNVHYA8Y sga6ICHt2PGD1RDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 35967134F5; Thu, 19 Jan 2023 09:46:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9kTsC2ERyWOPBgAAMHmgww (envelope-from ); Thu, 19 Jan 2023 09:46:09 +0000 Date: Thu, 19 Jan 2023 10:46:08 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jan Hubicka , Jakub Jelinek Subject: [PATCH] tree-optimization/108449 - keep maybe_special_function_p behavior MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20230119094609.35967134F5@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP 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: When we have a static declaration without definition we diagnose that and turn it into an extern declaration. That can alter the outcome of maybe_special_function_p here and there's really no point in doing that, so don't. Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? Thanks, Richard. PR tree-optimization/108449 * cgraphunit.cc (check_global_declaration): Do not turn undefined statics into externs. * gcc.dg/pr108449.c: New testcase. --- gcc/cgraphunit.cc | 2 -- gcc/testsuite/gcc.dg/pr108449.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr108449.c diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc index 59ce2708b7b..832818d651f 100644 --- a/gcc/cgraphunit.cc +++ b/gcc/cgraphunit.cc @@ -1087,8 +1087,6 @@ check_global_declaration (symtab_node *snode) else warning (OPT_Wunused_function, "%q+F declared % but never " "defined", decl); - /* This symbol is effectively an "extern" declaration now. */ - TREE_PUBLIC (decl) = 1; } /* Warn about static fns or vars defined but not used. */ diff --git a/gcc/testsuite/gcc.dg/pr108449.c b/gcc/testsuite/gcc.dg/pr108449.c new file mode 100644 index 00000000000..4a3ae5b3ed4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108449.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +static int vfork(); /* { dg-warning "used but never defined" } */ +void f() { vfork(); } -- 2.35.3