From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 355783887F54; Sat, 12 Nov 2022 23:45:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 355783887F54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32e.google.com with SMTP id t25-20020a1c7719000000b003cfa34ea516so7082433wmi.1; Sat, 12 Nov 2022 15:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YEv9FQ1bNUkETM+fNqeiGPFH8ZhUHuhSH9iWVk3yrNU=; b=QiLCvgkUZsQXRc2p4JfqaeouuIP2cIXlKw77p3Og87pQpBJ0jsYrezNVu0BSTekLSO 85aW7FdXUDv8I1+01BItKgIMnfGtfCvbah8gUGkG2zGZfyaseCBCEgr/ZemjPqWw9UB1 w0dk65s790fKT0BED4j9g7ESyIqwTJHDlHkNkOQRZJhqhjauugtV9RoWohjquvXV9qTt pxFtW6zmwnMopqUKBHGk8+hauAxJO52CoBqcLRENMzVyRu8FfOE25XXQm1dXLXqWVlju FYgd2AZIdp9yYF6/HJ89Bs16cLmrE9vKDBXSLAxlp7Nhq13Bs/ixhgdj/YWoF7VpIdKg JdEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YEv9FQ1bNUkETM+fNqeiGPFH8ZhUHuhSH9iWVk3yrNU=; b=7GbXFIm77XiLJv7ZqTCOzeFAs+ob/nEi0NVwjXdldnXXNYBxyLcMwCoTu249nlirAh XN0HmVRPZTHoBB+5OJBmCFTT8uet5Olkgo5i+rT9RqqfBOzpHb9p6+FDjNow4oFMOK98 xHpXdLP+ro88LSmZP+gywj/2iP5DCuaPVOVnbCtp5S0xubfD4wVVd+qgRH7IrO/Wl56d CmAhuq8+oPppYudchaep3jG101WUzrfoBufV5sv6tynBPDbEznoCUGUVSc2GUXR+up5I +xWDPYIfTss80iHAZ0B2iG/blaWCYR2pb5hRLz74TA3KxvnuMolBOlo4EOLNjeqp8Pn7 ZFxg== X-Gm-Message-State: ANoB5pnzxVCb+D5m1tEnm9oN49H8nfnkO0/oLvMdnZ1o/wpD62VrcPwd Eigl0E+pbEZI8rc7N0oyh5s= X-Google-Smtp-Source: AA0mqf61CmLkfchoUQ+zCHchCFmLFWRQLP98PbnFE1qMqauVAjdgu1tw/a8Z6sQga2Mh4E5SkogFKg== X-Received: by 2002:a05:600c:35d6:b0:3cf:cf89:2f02 with SMTP id r22-20020a05600c35d600b003cfcf892f02mr4724920wmq.2.1668296746935; Sat, 12 Nov 2022 15:45:46 -0800 (PST) Received: from nbbrfq ([2001:871:227:81c4:d7ff:3a0e:48da:5fe3]) by smtp.gmail.com with ESMTPSA id c7-20020a1c3507000000b003c6f1732f65sm12631398wma.38.2022.11.12.15.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 15:45:45 -0800 (PST) From: Bernhard Reutner-Fischer X-Google-Original-From: Bernhard Reutner-Fischer Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1ou0C1-000Opo-02; Sun, 13 Nov 2022 00:45:45 +0100 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer , Bernhard Reutner-Fischer , fortran@gcc.gnu.org, Joseph Myers Subject: [PATCH 1/5] c: Set the locus of the function result decl Date: Sun, 13 Nov 2022 00:45:39 +0100 Message-Id: <20221112234543.95441-2-aldot@gcc.gnu.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221112234543.95441-1-aldot@gcc.gnu.org> References: <20221112234543.95441-1-aldot@gcc.gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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: Bootstrapped and regtested on x86_86-unknown-linux with no regressions. Ok for trunk? Cc: Joseph Myers --- gcc/c/ChangeLog: * c-decl.cc (start_function): Set the result decl source location to the location of the typespec. --- 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 a99b7456055..5250cb96c41 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -9980,6 +9980,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; @@ -10206,8 +10207,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; -- 2.38.1