public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ibuclaw at gdcproject dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94541] New: -mx32 gcc produces wrong code passing structs by value
Date: Thu, 09 Apr 2020 13:48:58 +0000	[thread overview]
Message-ID: <bug-94541-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 94541
           Summary: -mx32 gcc produces wrong code passing structs by value
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Created attachment 48250
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48250&action=edit
test case

Attached reduced example.

Compiled with 'g++ -Wall -Wextra -fno-strict-aliasing -fwrapv', the run-time
results of the following combinations:

-O0 -m64:   0  0
-O1 -m64:   0  0
-O2 -m64:   0  0
-O3 -m64:   0  0
-O0 -m32:   0  0
-O1 -m32:   0  0
-O2 -m32:   0  0
-O3 -m32:   0  0
-O0 -mx32:  0  0
-O1 -mx32: -1 22  // munmap failed, EINVAL
-O2 -mx32: -1 22
-O3 -mx32: -1 22

A failure is not observed when:

- The condition is: if (b.ptr && b.length)
- The condition is: if (b.length)
- The ptr and length fields in Array are swapped.
- Array is passed by reference.


Tested with 8.4.0, 9.2.0, and 10.0.1.  All have the same problem.

             reply	other threads:[~2020-04-09 13:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 13:48 ibuclaw at gdcproject dot org [this message]
2020-04-09 13:55 ` [Bug target/94541] " ibuclaw at gdcproject dot org
2020-04-09 14:40 ` jakub at gcc dot gnu.org
2020-04-09 15:29 ` [Bug target/94541] [8/9/10 Regression] " hjl.tools at gmail dot com
2020-04-09 16:57 ` ibuclaw at gdcproject dot org
2020-04-09 16:59 ` ibuclaw at gdcproject dot org
2020-04-09 20:31 ` hjl.tools at gmail dot com
2020-04-09 20:32 ` hjl.tools at gmail dot com
2020-04-09 20:42 ` [Bug middle-end/94541] " hjl.tools at gmail dot com
2020-04-09 20:53 ` pinskia at gcc dot gnu.org
2020-04-09 21:04 ` hjl.tools at gmail dot com
2020-04-09 21:07 ` hjl.tools at gmail dot com
2020-04-09 21:32 ` pinskia at gcc dot gnu.org
2020-04-09 22:28 ` hjl.tools at gmail dot com
2020-04-09 22:32 ` [Bug target/94541] " pinskia at gcc dot gnu.org
2020-04-09 23:24 ` hjl.tools at gmail dot com
2020-04-09 23:28 ` hjl.tools at gmail dot com
2020-04-10 10:57 ` hjl.tools at gmail dot com
2020-04-10 11:20 ` ibuclaw at gdcproject dot org

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-94541-4@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).