From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 243203858D33; Mon, 23 Jan 2023 07:27:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 243203858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674458855; bh=6CcekrfdgTYnpaAQC5i3gc4pm6Eugx98aKChClSIYMU=; h=From:To:Subject:Date:From; b=pUwVvGV15ZxGHcRvunPgdG7UW5/zQi3RvTEoccNBvGRQE7oBraHeRIn5KFxGDpdG0 e3VOMJZBPP5/S7hJ3ynQvIf25VpXuBnSjCOqzYtLykwKZrnQlznP0Gv3fmC3tiIjSZ fyXCMT0jrk7nk0cPgXmpFAduOra072cR6FWCZDTM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5285] tree-optimization/108449 - keep maybe_special_function_p behavior X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: e61d43791e0943414d33c96de1dd4bfe5f611e29 X-Git-Newrev: 106f99406312d7ed47434de53c180718225ffa5e Message-Id: <20230123072735.243203858D33@sourceware.org> Date: Mon, 23 Jan 2023 07:27:35 +0000 (GMT) List-Id: https://gcc.gnu.org/g:106f99406312d7ed47434de53c180718225ffa5e commit r13-5285-g106f99406312d7ed47434de53c180718225ffa5e Author: Richard Biener Date: Thu Jan 19 08:44:25 2023 +0100 tree-optimization/108449 - keep maybe_special_function_p behavior 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. PR tree-optimization/108449 * cgraphunit.cc (check_global_declaration): Do not turn undefined statics into externs. * gcc.dg/pr108449.c: New testcase. Diff: --- gcc/cgraphunit.cc | 2 -- gcc/testsuite/gcc.dg/pr108449.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) 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(); }