public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112289] New: '-fstore-merging' causing instrument loss
@ 2023-10-30 12:18 Sean.XiaoXiang at outlook dot com
  2023-10-30 12:44 ` [Bug c/112289] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sean.XiaoXiang at outlook dot com @ 2023-10-30 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112289
           Summary: '-fstore-merging' causing instrument loss
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Sean.XiaoXiang at outlook dot com
  Target Milestone: ---

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
@ 2023-10-30 12:44 ` pinskia at gcc dot gnu.org
  2023-10-30 12:50 ` Sean.XiaoXiang at outlook dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2023-10-30
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Did you accidentally press the button to submit before writing something?

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
  2023-10-30 12:44 ` [Bug c/112289] " pinskia at gcc dot gnu.org
@ 2023-10-30 12:50 ` Sean.XiaoXiang at outlook dot com
  2023-10-30 13:05 ` Sean.XiaoXiang at outlook dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sean.XiaoXiang at outlook dot com @ 2023-10-30 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from xiao xiang <Sean.XiaoXiang at outlook dot com> ---
Yes,  exactly what I did. sorry about that. Already fixed 😊

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送

发件人: pinskia at gcc dot gnu.org<mailto:gcc-bugzilla@gcc.gnu.org>
发送时间: 2023年10月30日 20:44
收件人: Sean.XiaoXiang@outlook.com<mailto:Sean.XiaoXiang@outlook.com>
主题: [Bug c/112289] '-fstore-merging' causing instrument loss

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2023-10-30
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Did you accidentally press the button to submit before writing something?

--
You are receiving this mail because:
You reported the bug.

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
  2023-10-30 12:44 ` [Bug c/112289] " pinskia at gcc dot gnu.org
  2023-10-30 12:50 ` Sean.XiaoXiang at outlook dot com
@ 2023-10-30 13:05 ` Sean.XiaoXiang at outlook dot com
  2023-10-30 13:14 ` Sean.XiaoXiang at outlook dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sean.XiaoXiang at outlook dot com @ 2023-10-30 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from xiao xiang <Sean.XiaoXiang at outlook dot com> ---
Hello,

Have I submited information successful? It shows success, but I can’t read the
history I submited anywhere.

Thank you very much.

Sean

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送

发件人: gcc-bugzilla@gcc.gnu.org<mailto:gcc-bugzilla@gcc.gnu.org>
发送时间: 2023年10月30日 20:51
收件人: xiao xiang<mailto:Sean.XiaoXiang@outlook.com>
主题: Re: 回复: [Bug c/112289] '-fstore-merging' causing instrument loss

Attachments with a MIME type of "text/html" are not allowed on this
installation.

xiao xiang wrote:
> Yes,  exactly what I did. sorry about that. Already fixed 😊
>
> 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>å‘é€
>
> å‘件人: pinskia at gcc dot gnu.org<mailto:gcc-bugzilla@gcc.gnu.org>
> å‘é€æ—¶é—´: 2023å¹´10月30æ—¥ 20:44
> 收件人: Sean.XiaoXiang@outlook.com<mailto:Sean.XiaoXiang@outlook.com>
> 主题: [Bug c/112289] '-fstore-merging' causing instrument loss
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112289
>
> Andrew Pinski <pinskia at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |WAITING
>    Last reconfirmed|                            |2023-10-30
>      Ever confirmed|0                           |1
>
> --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> Did you accidentally press the button to submit before writing something?

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
                   ` (2 preceding siblings ...)
  2023-10-30 13:05 ` Sean.XiaoXiang at outlook dot com
@ 2023-10-30 13:14 ` Sean.XiaoXiang at outlook dot com
  2023-10-30 13:23 ` pinskia at gcc dot gnu.org
  2023-10-30 13:24 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: Sean.XiaoXiang at outlook dot com @ 2023-10-30 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from xiao xiang <Sean.XiaoXiang at outlook dot com> ---
--------------- description ----------------
some store instructions will be lost under certain conditions.
1、      GCC version >= 12.1
2、      Optimization enable at ‘-Os’ (actually is -fstore-merging)
3、      Code like the sample below

We also had some tests and the results (based on GCC version 13.2.0)
Fails with -Os
Passes with -Os -fno-store-merging
Passes with -Os -fno-ipa-modref
Passes with -Os -fno-ssa-phiopt
Passes with -Os -fno-tree-dse
Passes with -Os -fno-tree-pta

Passes with -O1
Fails with -O1 -fstore-merging

---------------Sample code merge.c ----------------
#include <stdio.h>
typedef union {
    struct {
        int bit0:1;
        int bit1:1;
        int bit2:1;
    };

    int data;
} BITS;

void init(BITS *val, int flag)
{
    val->bit1 = 1;
    val->bit2 = 1;
    if (flag > 1) {
        val->bit2 = 0;
    }
    return;
}

int main(int argc, char **argv)
{
    (void)argv;
    BITS value;
    value.data = 0;
    value.bit0 = 1;         // lost instrument
    init(&value, argc);
    printf("%x\n", value);
    return 0;
}

--------------- command line ----------------
--------------- compile option ----------------
--------------- expected and actual behavior ----------------
$ gcc -Os merge.c
$ ./a.exe
6          <--------- expect 7, but bit0 not set

--------------- system ----------------
windows 10 with mingw64
Linux x86_64 tested the same

--------------- gcc version ----------------
$ gcc -v
Using built-in specs.
COLLECT_GCC=D:\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-13.2.0/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--prefix=/mingw64--with-sysroot=/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64
--enable-host-shared --disable-multilib --enable-languages=c,c++,fortran,lto
--enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp
--enable-libatomic --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--enable-libstdcxx-filesystem-ts=yes --disable-libssp --disable-libstdcxx-pch
--disable-libstdcxx-debug --enable-bootstrap --disable-rpath
--disable-win32-registry --disable-nls --disable-werror --disable-symvers
--with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2
--with-libiconv --with-system-zlib
--with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static
--with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static
--with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-static
--with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-Builds project'
--with-bugurl=https://github.com/niXman/mingw-builds CFLAGS='-O2 -pipe
-fno-ident
-I/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64/opt/include
-I/c/buildroot/prerequisites/x86_64-zlib-static/include
-I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -fno-ident
-I/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64/opt/include
-I/c/buildroot/prerequisites/x86_64-zlib-static/include
-I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS='
-I/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64/opt/include
-I/c/buildroot/prerequisites/x86_64-zlib-static/include
-I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe
-fno-ident
-L/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64/opt/lib
-L/c/buildroot/prerequisites/x86_64-zlib-static/lib
-L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib '
LD_FOR_TARGET=/c/buildroot/x86_64-1320-posix-seh-msvcrt-rt_v11-rev0/mingw64/bin/ld.exe
--with-boot-ldflags=' -Wl,--disable-dynamicbase -static-libstdc++
-static-libgcc'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (x86_64-posix-seh-rev0, Built by MinGW-Builds project)

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
                   ` (3 preceding siblings ...)
  2023-10-30 13:14 ` Sean.XiaoXiang at outlook dot com
@ 2023-10-30 13:23 ` pinskia at gcc dot gnu.org
  2023-10-30 13:24 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.4.0, 14.0
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0
      Known to fail|                            |12.1.0, 12.3.0, 13.1.0,
                   |                            |13.2.0

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

* [Bug c/112289] '-fstore-merging' causing instrument loss
  2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
                   ` (4 preceding siblings ...)
  2023-10-30 13:23 ` pinskia at gcc dot gnu.org
@ 2023-10-30 13:24 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 111613.

*** This bug has been marked as a duplicate of bug 111613 ***

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

end of thread, other threads:[~2023-10-30 13:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 12:18 [Bug c/112289] New: '-fstore-merging' causing instrument loss Sean.XiaoXiang at outlook dot com
2023-10-30 12:44 ` [Bug c/112289] " pinskia at gcc dot gnu.org
2023-10-30 12:50 ` Sean.XiaoXiang at outlook dot com
2023-10-30 13:05 ` Sean.XiaoXiang at outlook dot com
2023-10-30 13:14 ` Sean.XiaoXiang at outlook dot com
2023-10-30 13:23 ` pinskia at gcc dot gnu.org
2023-10-30 13:24 ` 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).