public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102733] New: missing fs:0 store when followed by one to gs:0
@ 2021-10-13 16:48 msebor at gcc dot gnu.org
  2021-10-13 18:49 ` [Bug rtl-optimization/102733] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-13 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-02 19:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 16:48 [Bug target/102733] New: missing fs:0 store when followed by one to gs:0 msebor at gcc dot gnu.org
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

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).