From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 8D7DF3840C1D for ; Fri, 15 Jan 2021 08:58:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8D7DF3840C1D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-Y1yhoonUMke3pLiIKKvdIw-1; Fri, 15 Jan 2021 03:58:50 -0500 X-MC-Unique: Y1yhoonUMke3pLiIKKvdIw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EE3E15727; Fri, 15 Jan 2021 08:58:49 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-64.ams2.redhat.com [10.36.112.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA8BC60BF3; Fri, 15 Jan 2021 08:58:48 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 10F8wj1W1333466 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 15 Jan 2021 09:58:45 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 10F8wiLs1333465; Fri, 15 Jan 2021 09:58:44 +0100 Date: Fri, 15 Jan 2021 09:58:44 +0100 From: Jakub Jelinek To: Richard Biener , Martin Sebor , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c-family, v2: Improve MEM_REF printing for diagnostics [PR98597] Message-ID: <20210115085844.GF1034503@tucnak> Reply-To: Jakub Jelinek References: <20210113191122.GO1034503@tucnak> <20210114182636.GZ1034503@tucnak> MIME-Version: 1.0 In-Reply-To: <20210114182636.GZ1034503@tucnak> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2021 08:58:56 -0000 On Thu, Jan 14, 2021 at 07:26:36PM +0100, Jakub Jelinek via Gcc-patches wrote: > Is this ok for trunk if it passes bootstrap/regtest? So, x86_64-linux bootstrap unfortunately broke due to the -march=i486 changes, but at least i686-linux bootstrap succeeded and shows 2 regressions. One is on g++.dg/gomp/allocate-2.C, which used to print: allocate-2.C:9:36: error: user defined reduction not found for ‘s’ but now prints: allocate-2.C:9:36: error: user defined reduction not found for ‘*&s’ because of -O0 and therefore -fno-strict-aliasing. The problem is that for !flag_strict_aliasing get_deref_alias_set returns 0 and so the: && get_deref_alias_set (TREE_OPERAND (e, 1)) == get_alias_set (op) check fails. So, shall the code use && (!flag_no_strict_aliasing || get_deref_alias_set (TREE_OPERAND (e, 1)) == get_alias_set (op)) instead, or get_alias_set (TREE_TYPE (TREE_TYPE (TREE_OPERAND (e, 1)))) == get_alias_set (op) ? The other is on gcc.dg/gomp/_Atomic-3.c test, where we used to print _Atomic-3.c:22:34: error: ‘_Atomic’ ‘k’ in ‘reduction’ clause but now print _Atomic-3.c:22:34: error: ‘_Atomic’ ‘*(_Atomic int (*)[4])(&k[0])’ in ‘reduction’ clause Apparently in this case the C FE considers the two _Atomic int [4] types incompatible, one is created through c_build_qualified_type (type=, type_quals=8, orig_qual_type=, orig_qual_indirect=1) on an int [4] type, i.e. adding _Atomic qualifier to an unqualified array type, and the other is created through build_array_type (elt_type=, index_type=, typeless_storage=false) i.e. creating an array with _Atomic int elements. That seems like a C FE bug to me. Anyway, I can fix or workaround that by: --- gcc/c/c-typeck.c.jj 2021-01-04 10:25:49.651111329 +0100 +++ gcc/c/c-typeck.c 2021-01-15 09:53:29.590611264 +0100 @@ -13979,7 +13979,9 @@ c_finish_omp_clauses (tree clauses, enum size = size_binop (MINUS_EXPR, size, size_one_node); size = save_expr (size); tree index_type = build_index_type (size); - tree atype = build_array_type (type, index_type); + tree atype = build_array_type (TYPE_MAIN_VARIANT (type), + index_type); + atype = c_build_qualified_type (atype, TYPE_QUALS (type)); tree ptype = build_pointer_type (type); if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) t = build_fold_addr_expr (t); and then we're back to the above allocate-2.C issue, i.e. at -O0 we still print *&k rather than k. And another question is if in case we punted because of the TBAA check we shouldn't just force printing the access type, so never print *&k but print instead *(access type)&k. Jakub