From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id 9E2F03972831 for ; Tue, 16 Feb 2021 12:13:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9E2F03972831 Received: by mail-il1-x133.google.com with SMTP id d20so8094709ilo.4 for ; Tue, 16 Feb 2021 04:13:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FqLZ49QxRER7IsN9VcPeugMzCzGD9Nunpnvl1U2FcBY=; b=I5Msmm5dLqV0N10ClhycTDNhigBQhveaVUbL21D2PjvsUNWAcG0Ocvwy6tNqHr5k/D BPkY9+9fbf6KiT6i98R6vb2RBGeEVeJxS/jlv0tZMjSyOgHyJzAQZPtGj29rsgX2cgTF FQho8azEuXdBiEQPp+fpxrKznPmrhBxM5DbzkbhPaZhhDK0DB0rsAtaRpO15bOsKMqJq aLWpYjd+mtcu3uAu4R8kELKqVKB04od0jr5CH1WuybV38pYI+rYqJAZlfiSGutJMkdAZ 45qKynJEJgpxkDfSa8eBpxzQTX+fyFKjJLNDFvHmXtykbPgGg37oYHpRJ6IGs9szMosH u2cA== X-Gm-Message-State: AOAM530BwQUQoTyNFetMtuQZLvYRBWUOYh1S5xA3BlKogWCSDMC56PSL DKNkle0FDtqDm98MOyypHMLkw6tYpS8O7oxEQFy9gjiHht442g== X-Google-Smtp-Source: ABdhPJyezv4SNSitQyCxPMZcatrN6TLG78y+PAMGrK7qeLbZ676jYZoGpPGQlG5cGq99+M/oMinPtutXb1fn4xsDb1A= X-Received: by 2002:a05:6e02:1a6e:: with SMTP id w14mr16262976ilv.3.1613477600083; Tue, 16 Feb 2021 04:13:20 -0800 (PST) MIME-Version: 1.0 References: <31a47579-3b10-fc3c-8eef-0edc5b03bc5b@suse.cz> In-Reply-To: <31a47579-3b10-fc3c-8eef-0edc5b03bc5b@suse.cz> From: Shuai Wang Date: Tue, 16 Feb 2021 20:13:09 +0800 Message-ID: Subject: Re: Get struct function* from function declaration To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: GCC Development X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 12:13:22 -0000 Thank you for your reply! I tried to use this in the following code: tree func_decl =3D gimple_call_fndecl(stmt); // stmt is the function call statement function* f =3D DECL_STRUCT_FUNCTION(func_decl); std::cerr << get_name(f->decl) << std::endl; However, it seems the last line throws an exception as follows: during GIMPLE pass: XXX // here XXX is my pass name internal compiler error: Segmentation fault ... That seems strange. Does that seem familiar to you by any chance? Thank you! Best, Shuai On Tue, Feb 16, 2021 at 7:52 PM Martin Li=C5=A1ka wrote: > On 2/16/21 9:51 AM, Shuai Wang via Gcc wrote: > > However, can I proceed further to get the function* of "foo"? I checked > > Hello. > > Yes, you can call DECL_STRUCT_FUNCTION(func_decl). > > Martin >