From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id AD1523844042 for ; Tue, 4 Aug 2020 06:44:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AD1523844042 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=franke.ms Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=stefan@franke.ms Received: from serveronline.org ([78.46.86.77]:51739 helo=franke.ms) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k2qgS-0004Tf-Ax for gcc-help@gcc.gnu.org; Tue, 04 Aug 2020 02:44:26 -0400 Received: from ZETRA (pd9e55617.dip0.t-ipconnect.de [217.229.86.23]) by serveronline.org (BEJY V1.6.12-SNAPSHOT (c) 2000-2019 by BebboSoft, Stefan "Bebbo" Franke, all rights reserved) with SMTP id 173b836ae672da83572c4aa1f4f from stefan@franke.ms for gcc-help@gcc.gnu.org; Tue, 04 Aug 2020 07:44:18 +0100 From: "Stefan Franke" To: References: <00cd01d668f8$eb26b950$c1742bf0$@franke.ms> In-Reply-To: Subject: AW: C and C++ parser performing optimizations Date: Tue, 4 Aug 2020 08:44:18 +0200 Message-ID: <000301d66a2a$ad8dcb50$08a961f0$@franke.ms> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIoofI7fDD9ID/mfoLzAHfDQrR3agGT97PYqHZwX0A= Content-Language: de Received-SPF: pass client-ip=78.46.86.77; envelope-from=stefan@franke.ms; helo=franke.ms X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/04 02:44:18 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_FAIL, SPF_HELO_NONE, TXREP autolearn=no 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 06:44:28 -0000 > -----Urspr=FCngliche Nachricht----- > Von: Alexander Monakov > Gesendet: Sonntag, 2. August 2020 20:41 > An: Stefan Franke > Cc: gcc-help@gcc.gnu.org > Betreff: Re: C and C++ parser performing optimizations >=20 > On Sun, 2 Aug 2020, Stefan Franke wrote: >=20 > > So the parser performs unwanted and uncontrollable optimizations, > > which I consider bogus. >=20 > On occasion they are also incorrect. >=20 > My (possibly wrong or incomplete) understanding is that GCC does not = have > internal separation of mandatory simplifications that need to be done = in the > frontend (like constant folding in the context of integer constant > expressions) vs. optional simplifications (optimizing substitutions). > So it just does both at the same time. >=20 > Alexander Here is an example where gcc creates wrong code: test.c: int foo() { const char * const txt =3D "hello"; register const char * const p asm("ecx") =3D txt; register int dx asm("edx"); asm(" call _faa" :"=3Dr" (dx) :"rf" (p)); } gcc -O1 -S test.c -fdump-tree-original The variable p gets replaced and the asm input parameters are wrong: __asm__(" call _faa":"=3Dr" dx:"rf" (const char * const) "hello"); Uh - oh! Stefan