From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1472) id F3AB43852C72; Thu, 17 Nov 2022 19:41:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3AB43852C72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668714093; bh=4xAn9Ho2/6zwg1a3DacPqRLlql8Ks74g1u1CwJ4FV08=; h=From:To:Subject:Date:From; b=uRnPY/K8vIV30MTJVUICzSQCIm6NIxnBifZcSjKCmSN2UUM0auIVhTUXWTJrIPA5e H2k1r/GvXj4FQkqGn6WQzCwm2hErj7ePiiDHHb+YZA6yMx1B4FlCViauQufyk8xXnE lKm7up714JUM/v/MCcXAI+78SmVf5oifh5mN7zuI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Bernhard Reutner-Fischer To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4134] c: Set the locus of the function result decl X-Act-Checkin: gcc X-Git-Author: Bernhard Reutner-Fischer X-Git-Refname: refs/heads/master X-Git-Oldrev: 19be89d79ee149e812ccc6027956cefb7f3e1016 X-Git-Newrev: 3f467ea953431aa6af12aaed6d32f476f7ace1e5 Message-Id: <20221117194132.F3AB43852C72@sourceware.org> Date: Thu, 17 Nov 2022 19:41:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:3f467ea953431aa6af12aaed6d32f476f7ace1e5 commit r13-4134-g3f467ea953431aa6af12aaed6d32f476f7ace1e5 Author: Bernhard Reutner-Fischer Date: Sat Nov 6 06:48:00 2021 +0100 c: Set the locus of the function result decl gcc/c/ChangeLog: * c-decl.cc (start_function): Set the result decl source location to the location of the typespec. Diff: --- gcc/c/c-decl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 36de77814ba..098e475f65d 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -10059,6 +10059,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, tree decl1, old_decl; tree restype, resdecl; location_t loc; + location_t result_loc; current_function_returns_value = 0; /* Assume, until we see it does. */ current_function_returns_null = 0; @@ -10285,8 +10286,11 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, push_scope (); declare_parm_level (); + /* Set the result decl source location to the location of the typespec. */ + result_loc = (declspecs->locations[cdw_typespec] == UNKNOWN_LOCATION + ? loc : declspecs->locations[cdw_typespec]); restype = TREE_TYPE (TREE_TYPE (current_function_decl)); - resdecl = build_decl (loc, RESULT_DECL, NULL_TREE, restype); + resdecl = build_decl (result_loc, RESULT_DECL, NULL_TREE, restype); DECL_ARTIFICIAL (resdecl) = 1; DECL_IGNORED_P (resdecl) = 1; DECL_RESULT (current_function_decl) = resdecl;