From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0248A384BC21; Wed, 12 Aug 2020 19:40:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0248A384BC21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597261211; bh=X72KuBtdou1BmXgQbSU4vZxCQMdWKgNGOarIHrZsDdE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T+3gffFbni0cLFUDntPLkSxP7ICS5Wv464DlEtA/58WRkBWiBieDkLuLFUaihRZV5 8BoEN+K7lMN5ZPOR2OH1Cbd/GD1FhXEMEk+nR4kOpkhctBDgniMTxnO4JDNNoPVAT1 qutJZybztunap4HwtEgtrvnE5k0idojhLlnDh/EA= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96594] Compiled code behaves differently with -O1 and -O0 on s390x Date: Wed, 12 Aug 2020 19:40:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2020 19:40:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96594 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- That is just a user error, you didn't read the XChangeProperty man page. "If the specified format is 16, the property data must be a short array. If the specified format is 32, the property data must be a long arr= ay." You are using 32, and I assume you are doing this on 64-bit s390x, i.e. whe= re long is 64-bit, so while it sounds weird, libX11 requires you to put the property into a long or unsigned long variable and pass address of that (and read it through that too). It kind of "works" on x86_64, because it is little-endian, so you just have random bits in the upper 32 bits of the long that the library actually reads and perhaps it casts it to a 32-bit type later on. But s390x is big endian, so if you call it with address of a 32-bit variabl= e, the low 32 bits of that are the 32 bits after your variable and can contain arbitrary random values.=