From: Uros Bizjak Date: Sun, 11 Nov 2018 17:44:43 +0000 (+0100) Subject: backport: re PR c++/58372 (internal compiler error: ix86_compute_frame_layout) X-Git-Tag: releases/gcc-7.4.0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af4dbfeef6997bf42501acde84a37c0fecb46797;p=thirdparty%2Fgcc.git backport: re PR c++/58372 (internal compiler error: ix86_compute_frame_layout) Backport from mainline 2018-11-04 Uros Bizjak PR middle-end/58372 * cfgexpand.c (pass_expand::execute): Move the call to finish_eh_generation in front of the call to expand_stack_alignment. testsuite/ChangeLog: Backport from mainline 2018-11-04 Uros Bizjak PR middle-end/58372 * g++.dg/pr58372.C: New test. From-SVN: r266015 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6877a588aad..a65e60019dfe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-11-11 Uros Bizjak + + Backport from mainline + 2018-11-04 Uros Bizjak + + PR middle-end/58372 + * cfgexpand.c (pass_expand::execute): Move the call to + finish_eh_generation in front of the call to expand_stack_alignment. + 2018-11-07 Max Filippov Backport from mainline diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 4b9858225688..7fd3916a3c77 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -6466,6 +6466,14 @@ pass_expand::execute (function *fun) find_many_sub_basic_blocks (blocks); purge_all_dead_edges (); + /* After initial rtl generation, call back to finish generating + exception support code. We need to do this before cleaning up + the CFG as the code does not expect dead landing pads. */ + if (fun->eh->region_tree != NULL) + finish_eh_generation (); + + /* Call expand_stack_alignment after finishing all + updates to crtl->preferred_stack_boundary. */ expand_stack_alignment (); /* Fixup REG_EQUIV notes in the prologue if there are tailcalls in this @@ -6473,12 +6481,6 @@ pass_expand::execute (function *fun) if (crtl->tail_call_emit) fixup_tail_calls (); - /* After initial rtl generation, call back to finish generating - exception support code. We need to do this before cleaning up - the CFG as the code does not expect dead landing pads. */ - if (fun->eh->region_tree != NULL) - finish_eh_generation (); - /* Remove unreachable blocks, otherwise we cannot compute dominators which are needed for loop state verification. As a side-effect this also compacts blocks. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3564bfdc6b02..7cef3b011d5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2018-11-11 Uros Bizjak + + Backport from mainline + 2018-11-04 Uros Bizjak + + PR middle-end/58372 + * g++.dg/pr58372.C: New test. + 2018-11-08 Eric Botcazou * gnat.dg/null_pointer_deref1.adb: Remove -gnatp and add pragma. diff --git a/gcc/testsuite/g++.dg/pr58372.C b/gcc/testsuite/g++.dg/pr58372.C new file mode 100644 index 000000000000..865f88e987d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr58372.C @@ -0,0 +1,10 @@ +/* PR target/58372 */ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target c++14 } */ + +__attribute__ ((__target__ ("rdrnd"))) +void f (unsigned int *b) noexcept +{ + __builtin_ia32_rdrand32_step (b); +}