public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1
@ 2021-08-02 21:20 rsundahl at icloud dot com
2021-08-02 21:21 ` [Bug c++/101736] " rsundahl at icloud dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: rsundahl at icloud dot com @ 2021-08-02 21:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
Bug ID: 101736
Summary: Option -fno-reorder-functions breaks exceptions in gcc
8.2.1
Product: gcc
Version: 8.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rsundahl at icloud dot com
Target Milestone: ---
Created attachment 51245
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51245&action=edit
This is the source file
bash-4.4# g++ -v -save-temps -O2 -fno-reorder-functions
t-do-exceptions-work-at-all-with-this-compiler.cc && ./a.out
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--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
--enable-multilib --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl
--disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --enable-cet --with-tune=generic
--with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-reorder-functions'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus -E -quiet -v -D_GNU_SOURCE
t-do-exceptions-work-at-all-with-this-compiler.cc -mtune=generic -march=x86-64
-fno-reorder-functions -O2 -fpch-preprocess -o
t-do-exceptions-work-at-all-with-this-compiler.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward
/usr/lib/gcc/x86_64-redhat-linux/8/include
/usr/local/include
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-reorder-functions'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus -fpreprocessed
t-do-exceptions-work-at-all-with-this-compiler.ii -quiet -dumpbase
t-do-exceptions-work-at-all-with-this-compiler.cc -mtune=generic -march=x86-64
-auxbase t-do-exceptions-work-at-all-with-this-compiler -O2 -version
-fno-reorder-functions -o t-do-exceptions-work-at-all-with-this-compiler.s
GNU C++14 (GCC) version 8.4.1 20200928 (Red Hat 8.4.1-1) (x86_64-redhat-linux)
compiled by GNU C version 8.4.1 20200928 (Red Hat 8.4.1-1), GMP version
6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
warning: MPC header version 1.0.2 differs from library version 1.1.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (GCC) version 8.4.1 20200928 (Red Hat 8.4.1-1) (x86_64-redhat-linux)
compiled by GNU C version 8.4.1 20200928 (Red Hat 8.4.1-1), GMP version
6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
warning: MPC header version 1.0.2 differs from library version 1.1.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 38c2e671f40afe50da0df14ae856e910
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-reorder-functions'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
as -v --64 -o t-do-exceptions-work-at-all-with-this-compiler.o
t-do-exceptions-work-at-all-with-this-compiler.s
GNU assembler version 2.30 (x86_64-redhat-linux) using BFD version version
2.30-93.el8
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-reorder-functions'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin
/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
-plugin-opt=-fresolution=t-do-exceptions-work-at-all-with-this-compiler.res
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr
--hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/8
-L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../..
t-do-exceptions-work-at-all-with-this-compiler.o -lstdc++ -lm -lgcc_s -lgcc -lc
-lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-reorder-functions'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
terminate called after throwing an instance of 'std::invalid_argument'
what(): Test
Aborted
NOTE: Also confirmed with:
g++-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
g++ (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
@ 2021-08-02 21:21 ` rsundahl at icloud dot com
2021-08-02 21:57 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rsundahl at icloud dot com @ 2021-08-02 21:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
--- Comment #1 from Roy Sundahl <rsundahl at icloud dot com> ---
Created attachment 51246
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51246&action=edit
This is the preprocessed file (.ii)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
2021-08-02 21:21 ` [Bug c++/101736] " rsundahl at icloud dot com
@ 2021-08-02 21:57 ` pinskia at gcc dot gnu.org
2021-08-02 22:19 ` [Bug rtl-optimization/101736] " pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems to work in GCC 9 but GCC 9 does not do the partitioning of the function
so ...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
2021-08-02 21:21 ` [Bug c++/101736] " rsundahl at icloud dot com
2021-08-02 21:57 ` pinskia at gcc dot gnu.org
@ 2021-08-02 22:19 ` pinskia at gcc dot gnu.org
2021-08-02 22:42 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 22:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A workaround is to do -fno-reorder-blocks-and-partition if you do
-fno-reorder-function
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
` (2 preceding siblings ...)
2021-08-02 22:19 ` [Bug rtl-optimization/101736] " pinskia at gcc dot gnu.org
@ 2021-08-02 22:42 ` pinskia at gcc dot gnu.org
2021-08-03 3:33 ` [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions rsundahl at icloud dot com
2021-08-03 7:48 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 22:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-08-02
Ever confirmed|0 |1
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a testcase which fails on the trunk still:
inline void
throw_expr ()
{
throw 0;
}
void f(void) __attribute__((hot));
void f(void) {}
using namespace std;
int main1 (int t) __attribute__((noinline, hot));
int
main1 (int t)
{
if (t) { f(); return 0;}
try
{
throw_expr();
}
catch (int) { }
return 0;
}
int main(void)
{
return main1(0);
}
---------- CUT ------
I had to add some extra functions to force the partitioning to happen.
>From what I can tell -freorder-blocks-and-partition should be turned off if
-freorder-function is turned off.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
` (3 preceding siblings ...)
2021-08-02 22:42 ` pinskia at gcc dot gnu.org
@ 2021-08-03 3:33 ` rsundahl at icloud dot com
2021-08-03 7:48 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rsundahl at icloud dot com @ 2021-08-03 3:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
--- Comment #5 from Roy Sundahl <rsundahl at icloud dot com> ---
(In reply to Andrew Pinski from comment #3)
> A workaround is to do -fno-reorder-blocks-and-partition if you do
> -fno-reorder-function
That worked! Many thanks Andrew for vetting this bug so quickly and suggesting
this workaround. It is greatly appreciated.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
` (4 preceding siblings ...)
2021-08-03 3:33 ` [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions rsundahl at icloud dot com
@ 2021-08-03 7:48 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-03 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
We do
if (opts->x_flag_reorder_blocks_and_partition)
SET_OPTION_IF_UNSET (opts, opts_set, flag_reorder_functions, 1);
I guess that needs to be adjusted to disable -freorder-blocks-and-partition
when -freorder-functions is explicitely unset.
section *
default_function_section (tree decl, enum node_frequency freq,
bool startup, bool exit)
{
...
if (!flag_reorder_functions
|| !targetm_common.have_named_sections)
return NULL;
might be the actual issue though (the only user of the flag I can find)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-03 7:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 21:20 [Bug c++/101736] New: Option -fno-reorder-functions breaks exceptions in gcc 8.2.1 rsundahl at icloud dot com
2021-08-02 21:21 ` [Bug c++/101736] " rsundahl at icloud dot com
2021-08-02 21:57 ` pinskia at gcc dot gnu.org
2021-08-02 22:19 ` [Bug rtl-optimization/101736] " pinskia at gcc dot gnu.org
2021-08-02 22:42 ` pinskia at gcc dot gnu.org
2021-08-03 3:33 ` [Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions rsundahl at icloud dot com
2021-08-03 7:48 ` rguenth 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).