From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 721FA3858C60; Tue, 14 May 2024 09:21:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 721FA3858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 721FA3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715678517; cv=none; b=HyhHgLXMhepSIPqmoiqymC6ErZ5jXl/yeqo8aS3ltoaSyNjZKVuBAoeb2Cmh4aulTHWQc6F4MWj6g3aXMUvCrs+KWm99njf7TIwRgBEVZA1cDb+jVTky1k8aTn0tKDprHZFF1932klwyDtg0fFd9sSpwlXAwYSFqHyL070+8LtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715678517; c=relaxed/simple; bh=zIByIgmHoZ4PCTw1wvKczBytwD1pTaSHaEpT8lOeRCQ=; h=Date:From:To:Subject:Message-ID:Mime-Version; b=uhPdb8vOV117ecQkYTq0yLySrCxrrWkBuI6eNbSr1Rz1WLXjEY9u7hDXIl917czy+vpGHgHKh/pmgqm9b6Czkjl4hUXc4tmKnWtr3GwM6nbv/+us425iQd/1EPncbQDFAODLrQeo8ehKNWSGaGdpvazUBbMXX/KLwfYtcO0cDTU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 44E9Ksf4020581; Tue, 14 May 2024 04:20:54 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 44E9Ks3V020580; Tue, 14 May 2024 04:20:54 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 14 May 2024 04:20:54 -0500 From: Segher Boessenkool To: Jiufu Guo Cc: "Kewen.Lin" , dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] report message for operator %a on unaddressible exp Message-ID: <20240514092054.GF19790@gate.crashing.org> References: <20240513025712.889169-1-guojiufu@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_STOCKGEN,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Oh, btw: On Tue, May 14, 2024 at 11:00:38AM +0800, Jiufu Guo wrote: > >> --- a/gcc/config/rs6000/rs6000.cc > >> +++ b/gcc/config/rs6000/rs6000.cc > >> @@ -14659,6 +14659,12 @@ print_operand_address (FILE *file, rtx x) > >> else if (SYMBOL_REF_P (x) || GET_CODE (x) == CONST > >> || GET_CODE (x) == LABEL_REF) > >> { > >> + if (this_is_asm_operands && !address_operand (x, VOIDmode)) > >> + { > >> + output_operand_lossage ("invalid expression as operand"); > >> + return; > >> + } That error message is not so good. Firstly, it typically *is* a valid expression here, just not a correct expression to have for an address. But, more generally and usefully, the error message should say *what* is wrong about the expression (namely, it is not an address). Most of the time you can use the same error message for asm and other expressions, and you get a great message in all contexts. operand_lossage already takes care of telling the user "you did something foolish" for inline asm, or "ICE" if it is a compiler problem instead. In error messages you do not often know what caused the problem, so just report on the facts you *do* know (and moreso with warnings, there you typically only know something looks unusual). Segher