From patchwork Tue Sep 9 06:30:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 387157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 7386E1401B5 for ; Tue, 9 Sep 2014 16:31:04 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=WvXEP7lNeq1dFKbe8V3496b5zJyXnDAhzQhz6EDR/s6iEmJnkebNL glqGow+11gxc5n7apkSTifUY0lE5zQ2f/wlpwjYSKbikjegbDvjVc06oU/RLy+9u uS9SupzwNsvVEHHSt5rjdUhHDBqSQJmCBI/Uy4QTT8gbke4S7Ulwo4= 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 :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=+R+a0OmkdgHMAorNLelLhiNSDxY=; b=YeNYjgbds4UygBicDX1BU4ophKL7 Qs3G3qjv7s3ftUBk0QN0Ho8Xq1KccuW1t2jxlCAREL6JpR603di+eUXF8+ioxdfc v0DuSQceFTS1d73FA+t9N24J0ZyTpb5yzOGS4F5XucKiNfYxiXfGze/8DzPUgvXP 7eV9jiK5m2SxGtc= Received: (qmail 20909 invoked by alias); 9 Sep 2014 06:30:58 -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 20889 invoked by uid 89); 9 Sep 2014 06:30:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx02.qsc.de Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 09 Sep 2014 06:30:56 +0000 Received: from tux.net-b.de (port-92-194-105-242.dynamic.qsc.de [92.194.105.242]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPSA id 9B32D24CEA; Tue, 9 Sep 2014 08:30:51 +0200 (CEST) Message-ID: <540E9E97.6040602@net-b.de> Date: Tue, 09 Sep 2014 08:30:47 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Alessandro Fanfarillo , gfortran , gcc-patches Subject: Re: [PATCH, Fortran] Wrong invocation of caf_atomic_op References: In-Reply-To: Alessandro Fanfarillo wrote: > This email follows the previous without subject (sorry about that). I think I'd prefer the following patch, which avoids a temporary if none is required. "value" is a pointer if the kind is the same (see kind check before) and if it is not a literal. Otherwise, it isn't a pointer and one needs to generate a temporary. I do not quite understand why the current check doesn't work as both are integer(kind=4) but for some reasons one has a variant. Additionally, I wonder whether one should add a test case – one probably should do – and of which kind (run test + fdump-tree-original?). Tobias > The attached patch solves the problem raised by the following code: > > program atomic > use iso_fortran_env > implicit none > > integer :: me > integer(atomic_int_kind) :: atom[*] > me = this_image() > call atomic_define(atom[1],0) > sync all > call ATOMIC_ADD (atom[1], me) > if(me == 1) call atomic_ref(me,atom[1]) > sync all > write(*,*) me > > end program > > > Ok for trunk? --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -8398,3 +8398,3 @@ conv_intrinsic_atomic_op (gfc_code *code) - if (TREE_TYPE (TREE_TYPE (atom)) != TREE_TYPE (TREE_TYPE (value))) + if (!POINTER_TYPE_P (TREE_TYPE (value))) {