public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-96594-4-nhoaj5qubj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96594-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96594

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 array."
You are using 32, and I assume you are doing this on 64-bit s390x, i.e. where
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 variable,
the low 32 bits of that are the 32 bits after your variable and can contain
arbitrary random values.

  parent reply	other threads:[~2020-08-12 19:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 19:03 [Bug c++/96594] New: " mitya57 at gmail dot com
2020-08-12 19:04 ` [Bug c++/96594] " mitya57 at gmail dot com
2020-08-12 19:04 ` mitya57 at gmail dot com
2020-08-12 19:40 ` jakub at gcc dot gnu.org [this message]
2020-08-12 20:12 ` mitya57 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96594-4-nhoaj5qubj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).