[Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions

2021-08-03 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736

Richard Biener  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #6 from Richard Biener  ---
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)

[Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions

2021-08-02 Thread rsundahl at icloud dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736

--- Comment #5 from Roy Sundahl  ---
(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.

[Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1

2021-08-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-08-02
 Ever confirmed|0   |1

--- Comment #4 from Andrew Pinski  ---
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.

[Bug rtl-optimization/101736] Option -fno-reorder-functions breaks exceptions in gcc 8.2.1

2021-08-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101736

--- Comment #3 from Andrew Pinski  ---
A workaround is to do -fno-reorder-blocks-and-partition if you do
-fno-reorder-function