From patchwork Wed Jul 24 09:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1136195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-505589-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Wq0TWzEL"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45tqSB3gz0z9s3l for ; Wed, 24 Jul 2019 19:15:04 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=gc8C5+hBR1ch/9rl 0cYmpKGurxYadc7jb6vkQyPGMg4tTfxOMLNk4jJilC+jE+qRzQNKgPAemGBV/YPY nH+DPywo8l05SNSg6CqgtF3SmXsU1Meke+NTnbbSkG/PoFWcIkaVA1n/y3Ypzr5Y /riJimPfmsUo406MIDh3mvDvERI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=nHx5KS+8y0VyCecO/BG3je uyNRA=; b=Wq0TWzELwVoZFC6xz5diDwOenwiSJ/bxOP5YZ6Sw1RBQ3GtIvX5WkD hJWWEThxcjF1y8LqUrp+Aaby3dSrfSoMNK84I86px4BnAJKhgD5xoREcI7IOxts2 5meWhIOqVcOXOLueu+gjEhkjQ/t42oOI+cxkLTw3/sITQZjiGyG5M= Received: (qmail 11234 invoked by alias); 24 Jul 2019 09:14:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11225 invoked by uid 89); 24 Jul 2019 09:14:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=botcazou, Botcazou, U*ebotcazou, ebotcazouadacorecom X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Jul 2019 09:14:55 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id CB66782459 for ; Wed, 24 Jul 2019 11:14:52 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c8J8EWJw3Wq4 for ; Wed, 24 Jul 2019 11:14:52 +0200 (CEST) Received: from arcturus.home (adijon-653-1-143-55.w86-204.abo.wanadoo.fr [86.204.134.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 9291D82453 for ; Wed, 24 Jul 2019 11:14:52 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Set TREE_THIS_NOTRAP throughout tree-nested.c Date: Wed, 24 Jul 2019 11:14:59 +0200 Message-ID: <3162661.bVZMVEFtQX@arcturus.home> MIME-Version: 1.0 Hi, stack memory is considered non-trapping by the compiler once the frame has been established so TREE_THIS_NOTRAP can be set on the dereferences built during the unnesting pass. Tested on x86_64-suse-linux, OK for the mainline? 2019-07-24 Eric Botcazou * tree-nested.c (build_simple_mem_ref_notrap): New function. (get_static_chain): Call it instead of (build_simple_mem_ref. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. commit cbe1e80c5af525403608dc00ef5e92c5a9f85ee1 Author: Eric Botcazou Date: Wed Jul 17 18:11:32 2019 +0200 Part of work for S716-019 (compiler crash on nested task type at -O2). diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 60dfc548b5a..74c70681d40 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -169,6 +169,16 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix) return tmp_var; } +/* Like build_simple_mem_ref, but set TREE_THIS_NOTRAP on the result. */ + +static tree +build_simple_mem_ref_notrap (tree ptr) +{ + tree t = build_simple_mem_ref (ptr); + TREE_THIS_NOTRAP (t) = 1; + return t; +} + /* Take the address of EXP to be used within function CONTEXT. Mark it for addressability as necessary. */ @@ -877,7 +887,7 @@ get_static_chain (struct nesting_info *info, tree target_context, { tree field = get_chain_field (i); - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); x = init_tmp_var (info, x, gsi); } @@ -914,12 +924,12 @@ get_frame_field (struct nesting_info *info, tree target_context, { tree field = get_chain_field (i); - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); x = init_tmp_var (info, x, gsi); } - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); } x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); @@ -963,16 +973,16 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl) for (i = info->outer; i->context != target_context; i = i->outer) { field = get_chain_field (i); - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); } - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); } field = lookup_field_for_decl (i, decl, INSERT); x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); if (use_pointer_in_frame (decl)) - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); /* ??? We should be remapping types as well, surely. */ new_decl = build_decl (DECL_SOURCE_LOCATION (decl), @@ -1060,7 +1070,7 @@ convert_nonlocal_reference_op (tree *tp, int *walk_subtrees, void *data) if (use_pointer_in_frame (t)) { x = init_tmp_var (info, x, &wi->gsi); - x = build_simple_mem_ref (x); + x = build_simple_mem_ref_notrap (x); } }