public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112302] New: The Os optimisation level removes variable value being set in a particular instance
@ 2023-10-30 19:57 barryns86 at gmail dot com
2023-10-30 20:05 ` [Bug middle-end/112302] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: barryns86 at gmail dot com @ 2023-10-30 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112302
Bug ID: 112302
Summary: The Os optimisation level removes variable value being
set in a particular instance
Product: gcc
Version: 12.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barryns86 at gmail dot com
Target Milestone: ---
Created attachment 56478
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56478&action=edit
intermediate build output
When I compile with optimization Os I am getting an over optimization that
breaks my cpp code (variable value is not being set correctly), and I don't see
the issue with O1, O2, or O3. Also Os does not produce the issue on 10.3 (my
current compiler), or earlier versions. but does in all versions of 11 and 12
(that I have tried up to 12.3), and I am trying to update the compiler for a
separate reason.
I even tried doing O2 but setting the fno version of the flags that Os says it
does not include. That still worked.
In the code, The second parameter (v2) to sub_func2 (within function 1) should
be 25348, not 24580. The thing that is not happening is that variable b4 should
be set to 6, but its not. Its set to zero, no matter what value of "mode" is
passed to function1. I tried to simplify this example down as much as I can. If
you need me to try something else, or need any more info, please ask.
Here is my compile line for the test version of my issue.
g++ -v -save-temps -Os test.cc -o test
Attached in the ii file produced with 11.4.1 and the issue is present.
And here is the output from the build:
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-host-pie
--enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only --enable-plugin
--enable-initfini-array --without-isl --enable-multilib
--with-linker-hash-style=gnu --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64
--build=x86_64-redhat-linux --with-build-config=bootstrap-lto
--enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.1 20230605 (Red Hat 11.4.1-2) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Os' '-o' 'test' '-shared-libgcc'
'-mtune=generic' '-march=x86-64-v2'
/usr/libexec/gcc/x86_64-redhat-linux/11/cc1plus -E -quiet -v -D_GNU_SOURCE
test.cc -mtune=generic -march=x86-64-v2 -Os -fpch-preprocess -o test.ii
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/112302] The Os optimisation level removes variable value being set in a particular instance
2023-10-30 19:57 [Bug c++/112302] New: The Os optimisation level removes variable value being set in a particular instance barryns86 at gmail dot com
@ 2023-10-30 20:05 ` pinskia at gcc dot gnu.org
2023-10-30 20:09 ` pinskia at gcc dot gnu.org
2023-10-30 20:45 ` barryns86 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112302
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This might be undefined code dealing with unions and accesing the fields but
via a pointer outside a function ...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/112302] The Os optimisation level removes variable value being set in a particular instance
2023-10-30 19:57 [Bug c++/112302] New: The Os optimisation level removes variable value being set in a particular instance barryns86 at gmail dot com
2023-10-30 20:05 ` [Bug middle-end/112302] " pinskia at gcc dot gnu.org
@ 2023-10-30 20:09 ` pinskia at gcc dot gnu.org
2023-10-30 20:45 ` barryns86 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112302
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 106389.
*** This bug has been marked as a duplicate of bug 106389 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/112302] The Os optimisation level removes variable value being set in a particular instance
2023-10-30 19:57 [Bug c++/112302] New: The Os optimisation level removes variable value being set in a particular instance barryns86 at gmail dot com
2023-10-30 20:05 ` [Bug middle-end/112302] " pinskia at gcc dot gnu.org
2023-10-30 20:09 ` pinskia at gcc dot gnu.org
@ 2023-10-30 20:45 ` barryns86 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: barryns86 at gmail dot com @ 2023-10-30 20:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112302
--- Comment #3 from Barry Solomon <barryns86 at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> Dup of bug 106389.
>
> *** This bug has been marked as a duplicate of bug 106389 ***
Thank you very much. I did try looking around, and did not see this other bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-30 20:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 19:57 [Bug c++/112302] New: The Os optimisation level removes variable value being set in a particular instance barryns86 at gmail dot com
2023-10-30 20:05 ` [Bug middle-end/112302] " pinskia at gcc dot gnu.org
2023-10-30 20:09 ` pinskia at gcc dot gnu.org
2023-10-30 20:45 ` barryns86 at gmail dot com
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).