public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102733] New: missing fs:0 store when followed by one to gs:0
Date: Wed, 13 Oct 2021 16:48:57 +0000	[thread overview]
Message-ID: <bug-102733-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102733
           Summary: missing fs:0 store when followed by one to gs:0
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

While testing r12-4376 I noticed that when a fs:0 store is followed by one to
gs:0 the former is not emitted, otherwise when each is done on its own each is
also emitted on its own.  My very basic understanding is that the FS and GS
namespaces are distinct with null being a valid address of a distinct location
in each (and so I would expect both stores to be emitted) but I leave it
experts to confirm or resolve this as invalid.

$ cat z.c && gcc -O -S -Wall -o/dev/stdout z.c
void test_null_store_fs (void)
{
  int __seg_fs *fs = (int __seg_fs *)0;
  *fs = 1;   // fs:0 store emitted
}

void test_null_store_gs (void)
{
  int __seg_gs *gs = (int __seg_gs *)0;
  *gs = 2;   // gs:0 store emitted
}

void test_null_store_fs_gs (void)
{
  int __seg_fs *fs = (int __seg_fs *)0;
  *fs = 1;   // store missing

  int __seg_gs *gs = (int __seg_gs *)0;
  *gs = 2;   // gs:0 store emitted
}
        .file   "z.c"
        .text
        .globl  test_null_store_fs
        .type   test_null_store_fs, @function
test_null_store_fs:
.LFB0:
        .cfi_startproc
        movl    $1, %fs:0
        ret
        .cfi_endproc
.LFE0:
        .size   test_null_store_fs, .-test_null_store_fs
        .globl  test_null_store_gs
        .type   test_null_store_gs, @function
test_null_store_gs:
.LFB1:
        .cfi_startproc
        movl    $2, %gs:0
        ret
        .cfi_endproc
.LFE1:
        .size   test_null_store_gs, .-test_null_store_gs
        .globl  test_null_store_fs_gs
        .type   test_null_store_fs_gs, @function
test_null_store_fs_gs:
.LFB2:
        .cfi_startproc
        movl    $2, %gs:0
        ret
        .cfi_endproc
.LFE2:
        .size   test_null_store_fs_gs, .-test_null_store_fs_gs
        .ident  "GCC: (GNU) 12.0.0 20211013 (experimental)"
        .section        .note.GNU-stack,"",@progbits

             reply	other threads:[~2021-10-13 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 16:48 msebor at gcc dot gnu.org [this message]
2021-10-13 18:49 ` [Bug rtl-optimization/102733] " pinskia at gcc dot gnu.org
2021-10-13 18:55 ` pinskia at gcc dot gnu.org
2021-10-13 23:05 ` msebor at gcc dot gnu.org
2021-10-13 23:14 ` pinskia at gcc dot gnu.org
2023-06-02  3:39 ` pinskia at gcc dot gnu.org
2023-06-02  3:54 ` pinskia at gcc dot gnu.org
2023-06-02 19:48 ` cvs-commit at gcc dot gnu.org
2023-06-02 19:49 ` pinskia at gcc dot gnu.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-102733-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).