From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59984 invoked by alias); 23 May 2019 01:37:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 59976 invoked by uid 89); 23 May 2019 01:37:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-7.9 required=5.0 tests=BAYES_00,ENV_AND_HDR_SPF_MATCH,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,UNSUBSCRIBE_BODY,USER_IN_DEF_SPF_WL autolearn=no version=3.3.1 spammy=optout, U*unsubscribe, and=c2, unsubscribe@googlegroups.com?= X-HELO: mail-it1-f175.google.com Received: from mail-it1-f175.google.com (HELO mail-it1-f175.google.com) (209.85.166.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 May 2019 01:37:00 +0000 Received: by mail-it1-f175.google.com with SMTP id j17so6959206itk.0 for ; Wed, 22 May 2019 18:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YjA1ldrh/qxsEJOciHGhPvLEIL37gu0GG1ePg5j83Nw=; b=NbvzvaWCTNh81bugA1PIv3089xHS9OeWoxserWR/YylRj3VPaOtnNWwzJcEft1WF5K 6hJ1YAVyyu6IQ1ENc+V6uyOZ+ttzBBZftFhU4wFw8Q2CFlsr06whzaHLa10AYONcnWHq wa/J8xJCH1bwatUegSwZCPtW6UDyRSUd+CsT/mQlysjMBJ7/QAuGBpU31UAvFokSD0eQ 5fA3lhYsUbZXmT6QPMY9aMRzdTUo916dtReQJlBHNHvR8dTPAa/q/yqQm4pn2W6nj8l/ 3Fc91xVRL068cbm4b/DoplKswnP8Wiknc0s1KTXALIZAhO9VVjpnklPlgU6tj/7m6XQS ZPJg== MIME-Version: 1.0 References: <87a7fibpms.fsf@igel.home> In-Reply-To: From: "Cherry Zhang via gcc-patches" Reply-To: Cherry Zhang Date: Thu, 23 May 2019 01:37:00 -0000 Message-ID: Subject: Re: [gofrontend-dev] Re: Go patch committed: Intrinsify runtime/internal/atomic functions To: Jim Wilson Cc: Andreas Schwab , Ian Lance Taylor , gcc-patches , gofrontend-dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-05/txt/msg01548.txt.bz2 Jim, thank you for the fix! The patch looks good to me. Maybe we should also apply this to __atomic_add_fetch_4 and __atomic_add_fetch_8? Thanks, Cherry On Tue, May 21, 2019 at 11:25 PM Jim Wilson wrote: > On Sun, May 19, 2019 at 5:22 AM Andreas Schwab > wrote: > > ../../../libgo/go/runtime/mbitmap.go: In function > =E2=80=98runtime.setMarked.runtime.markBits=E2=80=99: > > ../../../libgo/go/runtime/mbitmap.go:291:9: internal compiler error: > Segmentation fault > > 291 | atomic.Or8(m.bytep, m.mask) > > | ^ > > This is failing for RISC-V because __atomic_or_fetch_1 isn't a > built-in function that can be expanded inline. You have to call the > library function in libatomic. The C front-end is registering all of > the built-in functions, but it looks like the go front-end is only > registering functions it thinks it needs and this list is incomplete. > In expand_builtin, case BUILT_IN_ATOMIC_OR_FETCH_1, the external > library call for this gets set to BUILT_IN_ATOMIC_FETCH_OR_1. Then in > expand_builtin_atomic_fetch_op when we call builtin_decl_explicit > (ext_call) it returns NULL. This is because the go front end > registered BUILT_IN_ATOMIC_OR_FETCH_1 as a built-in, but did not > register BUILT_IN_ATOMIC_FETCH_OR_1 as a built-in. The NULL return > from builtin_decl_explicit gives us an ADDR_EXPR with a NULL operand > which eventually causes the internal compiler error. It looks like > the same thing is done with all of the op_fetch built-ins, so use of > any of them means that the fetch_op built-in also has to be > registered. I verified with a quick hack that I need both > BUILT_IN_ATOMIC_FETCH_OR_1 and BUILT_IN_ATOMIC_FETCH_AND_1 defined as > built-ins to make a RISC-V go build work. I haven't done any testing > yet. > > Jim > > -- > You received this message because you are subscribed to the Google Groups > "gofrontend-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to gofrontend-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/gofrontend-dev/CAFyWVaY8aMmhmnWpoGdywae= EhiXmSUe8qqha%2BHhvbxYHhUnisQ%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. >