public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108040] New: -fdevirtualize causes part of function to be missing in output
@ 2022-12-09 22:01 alvinhochun at gmail dot com
  2023-04-28 11:29 ` [Bug ipa/108040] " jamborm at gcc dot gnu.org
  2023-04-28 12:35 ` alvin at alvinhc dot com
  0 siblings, 2 replies; 3+ messages in thread
From: alvinhochun at gmail dot com @ 2022-12-09 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108040
           Summary: -fdevirtualize causes part of function to be missing
                    in output
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alvinhochun at gmail dot com
  Target Milestone: ---

Created attachment 54057
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54057&action=edit
preprocessed source file

Using MSYS2 UCRT64 GCC 12.2.0

$ g++ -v
Using built-in specs.
COLLECT_GCC=C:\msys64\ucrt64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/ucrt64
--with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/ucrt64/include --libexe
cdir=/ucrt64/lib --enable-bootstrap --enable-checking=release
--with-arch=x86-64 --with-tune=generic
--enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared
--enable-static --enable-libatomic --enable-threads=po
six --enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib
--disable-rpath --disable-win32-registry --disa
ble-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib
--with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64
--with-pkgversion='Rev6, Built by MSYS2 project' --with-bugurl=https://git
hub.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld
--disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++
--with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Rev6, Built by MSYS2 project)


I compiled the original source with the following commands:

$ g++ -DCATCH_CONFIG_COLOUR_ANSI -D_WIN32_WINNT=0x0602
-ID:/dev/mingw-winrt/cppwinrt/test
-ID:/dev/mingw-winrt/cppwinrt/test/../cppwinrt
-IC:/msys64/home/Alvin/cppwinrt_rel/test/cppwinrt -O2 -g -DNDEBUG
-fno-omit-frame-pointer -fdiagnostics-color=always -mcx16 -O1
-finline-functions -finline-small-functions -findirect-inlining
-fno-devirtualize -std=gnu++20 -MD -MT
test/test/CMakeFiles/test-out_params_bad.dir/out_params_bad.cpp.obj -MF
'test\test\CMakeFiles\test-out_params_bad.dir\out_params_bad.cpp.obj.d'
D:/dev/mingw-winrt/cppwinrt/test/test/out_params_bad.cpp -g0 -S -o ../good.s
-fverbose-asm -save-temps

$ g++ -DCATCH_CONFIG_COLOUR_ANSI -D_WIN32_WINNT=0x0602
-ID:/dev/mingw-winrt/cppwinrt/test
-ID:/dev/mingw-winrt/cppwinrt/test/../cppwinrt
-IC:/msys64/home/Alvin/cppwinrt_rel/test/cppwinrt -O2 -g -DNDEBUG
-fno-omit-frame-pointer -fdiagnostics-color=always -mcx16 -O1
-finline-functions -finline-small-functions -findirect-inlining
-fno-devirtualize -std=gnu++20 -MD -MT
test/test/CMakeFiles/test-out_params_bad.dir/out_params_bad.cpp.obj -MF
'test\test\CMakeFiles\test-out_params_bad.dir\out_params_bad.cpp.obj.d'
D:/dev/mingw-winrt/cppwinrt/test/test/out_params_bad.cpp -g0 -S -o ../bad.s
-fdevirtualize -fverbose-asm -save-temps


I then compared `good.s` and `bad.s` and checked inside the function `static
void C_A_T_C_H_T_E_S_T_0()` (_ZL19C_A_T_C_H_T_E_S_T_0v). At around
`D:/dev/mingw-winrt/cppwinrt/test/test/out_params_bad.cpp:211`, `bad.s` is
missing a large chunk of the function (all the way to the function epilogue)
compared to `good.s`.

The only difference is that `bad.s` is compiled with `-fdevirtualize`.

Attached the preprocessed source with gzip compression.

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

* [Bug ipa/108040] -fdevirtualize causes part of function to be missing in output
  2022-12-09 22:01 [Bug c++/108040] New: -fdevirtualize causes part of function to be missing in output alvinhochun at gmail dot com
@ 2023-04-28 11:29 ` jamborm at gcc dot gnu.org
  2023-04-28 12:35 ` alvin at alvinhc dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-04-28 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Jambor <jamborm at gcc dot gnu.org> ---
It is probably me not being able to build the necessary cross compiler
properly, but I cannot build the provided testcase, I always get errors like
the following and then some more:

<built-in>: note:   initializing argument 2 of ‘__vector(4) float
__builtin_ia32_dpbf16ps_v4sf(__vector(4) float, __vector(8) __bf16, __vector(8)
__bf16)’
C:/msys64/ucrt64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/avx512bf16vlintrin.h:
In function ‘__m128 _mm_mask_dpbf16_ps(__m128, __mmask8, __m128bh, __m128bh)’:
C:/msys64/ucrt64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/avx512bf16vlintrin.h:169:57:
error: cannot convert ‘__m128bh’ to ‘__vector(8) __bf16’


It would be great if you could simplify the testcase (and also the necessary
command line) somewhat - and ideally reproduce it with pristine GCC.  Otherwise
you may want to report the issue to
https://github.com/msys2/MINGW-packages/issues

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

* [Bug ipa/108040] -fdevirtualize causes part of function to be missing in output
  2022-12-09 22:01 [Bug c++/108040] New: -fdevirtualize causes part of function to be missing in output alvinhochun at gmail dot com
  2023-04-28 11:29 ` [Bug ipa/108040] " jamborm at gcc dot gnu.org
@ 2023-04-28 12:35 ` alvin at alvinhc dot com
  1 sibling, 0 replies; 3+ messages in thread
From: alvin at alvinhc dot com @ 2023-04-28 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alvin Wong <alvin at alvinhc dot com> ---
Thanks for trying to look into the issue. The error you got looks like an
effect of
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=87235f1e5c740de9c6f72a5dd7d7eb9cb7df2e1d
that is not in GCC 12. I guess I can retest with GCC 13 but I don't have it
yet, so it will have to wait.

On simplifying the test case, I'm guessing I probably can't do much about that,
but, uh, I can maybe give it a try some time (no promises).

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

end of thread, other threads:[~2023-04-28 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 22:01 [Bug c++/108040] New: -fdevirtualize causes part of function to be missing in output alvinhochun at gmail dot com
2023-04-28 11:29 ` [Bug ipa/108040] " jamborm at gcc dot gnu.org
2023-04-28 12:35 ` alvin at alvinhc 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).