[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 Richard Biener changed: What|Removed |Added Target Milestone|10.5|11.0 Known to fail||10.5.0 Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #39 from Richard Biener --- Fixed in GCC 11.
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 Jakub Jelinek changed: What|Removed |Added Target Milestone|10.4|10.5 --- Comment #38 from Jakub Jelinek --- GCC 10.4 is being released, retargeting bugs to GCC 10.5.
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #37 from CVS Commits --- The releases/gcc-11 branch has been updated by Eric Botcazou : https://gcc.gnu.org/g:8b1190d527d01dc74ee53e47b0366d01270c330c commit r11-8508-g8b1190d527d01dc74ee53e47b0366d01270c330c Author: Eric Botcazou Date: Thu Jun 3 12:39:39 2021 +0200 Tame fix for PR ipa/99122 The return part has a major performance impact in Ada where variable-sized types are first-class citizens, but it turns out that it is not exercized in the testsuite yet, so back it out for now. gcc/ PR ipa/99122 * tree-inline.c (inline_forbidden_p): Remove test on return type. gcc/testsuite/ * gnat.dg/inline22.adb: New test.
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #36 from CVS Commits --- The master branch has been updated by Eric Botcazou : https://gcc.gnu.org/g:ad085ef5fb4142df2027f81ea03992fdafc6e2f6 commit r12-1176-gad085ef5fb4142df2027f81ea03992fdafc6e2f6 Author: Eric Botcazou Date: Thu Jun 3 12:39:39 2021 +0200 Tame fix for PR ipa/99122 The return part has a major performance impact in Ada where variable-sized types are first-class citizens, but it turns out that it is not exercized in the testsuite yet, so back it out for now. gcc/ PR ipa/99122 * tree-inline.c (inline_forbidden_p): Remove test on return type. gcc/testsuite/ * gnat.dg/inline22.adb: New test.
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #35 from Eric Botcazou --- > interestingly I see > > a.9_70 = .builtin_alloca_with_align (iftmp.8_1, 8); > (*a.9_70) = inline22.get_zero (); [static-chain: &FRAME.20] [return slot > optimization] > > so there's no WITH_SIZE_EXPR, but the return value ends up done by reference: > > leaq-80(%rbp), %rdx > movq%rdx, %r10 > movq%rax, %rdi > callinline22__get_zero.0 > movq%rbx, %rsp > movq-8(%rbp), %rbx > leave > > so I wonder if omitting DECL_BY_REFERENCE is simply a bug? I mean the > ABI of the callee must be aware and it seems CALL_EXPR_RETURN_SLOT_OPT > is set by gimplification. IIRC CALL_EXPR_RETURN_SLOT_OPT also only means > we _may_ return by reference not that we must. I don't think it's a bug, in the sense that you can be aggregate_value_p without being DECL_BY_REFERENCE, as it's the case here; the latter is explicit in the GIMPLE representation whereas the former is not. > But of course if we do not exercise the return slot opt then there definitely > is a WITH_SIZE_EXPR missing. Unless I'm missing somehting ... WITH_SIZE_EXPR is for something else (self-referential types). > so I wonder if you can modify the Ada testcase so that > CALL_EXPR_RETURN_SLOT_OPT is not set? No, CALL_EXPR_RETURN_SLOT_OPT is always set, that's the point.
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #34 from Richard Biener --- interestingly I see a.9_70 = .builtin_alloca_with_align (iftmp.8_1, 8); (*a.9_70) = inline22.get_zero (); [static-chain: &FRAME.20] [return slot optimization] so there's no WITH_SIZE_EXPR, but the return value ends up done by reference: leaq-80(%rbp), %rdx movq%rdx, %r10 movq%rax, %rdi callinline22__get_zero.0 movq%rbx, %rsp movq-8(%rbp), %rbx leave so I wonder if omitting DECL_BY_REFERENCE is simply a bug? I mean the ABI of the callee must be aware and it seems CALL_EXPR_RETURN_SLOT_OPT is set by gimplification. IIRC CALL_EXPR_RETURN_SLOT_OPT also only means we _may_ return by reference not that we must. /* In a CALL_EXPR, means that it's safe to use the target of the call expansion as the return slot for a call that returns in memory. */ #define CALL_EXPR_RETURN_SLOT_OPT(NODE) \ (CALL_EXPR_CHECK (NODE)->base.private_flag) But of course if we do not exercise the return slot opt then there definitely is a WITH_SIZE_EXPR missing. Unless I'm missing somehting ... The gimplifier code checks else if (TREE_CODE (*to_p) != SSA_NAME && (!is_gimple_variable (*to_p) || needs_to_live_in_memory (*to_p))) /* Don't use the original target if it's already addressable; if its address escapes, and the called function uses the NRV optimization, a conforming program could see *to_p change before the called function returns; see c++/19317. When optimizing, the return_slot pass marks more functions as safe after we have escape info. */ use_target = false; so I wonder if you can modify the Ada testcase so that CALL_EXPR_RETURN_SLOT_OPT is not set?
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #33 from Eric Botcazou --- > so that would mean adding > >&& !DECL_BY_REFERENCE (DECL_RESULT (fndecl)) > > I suppose or looking at DECL_RESULT in the first place (which is a pointer > in that case). Not in the array case though: (gdb) p debug_tree(fndecl->decl_non_common.result) decl_non_common.result->decl_common.decl_by_reference_flag $16 = 0
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 --- Comment #32 from Richard Biener --- + /* We cannot inline a function with a VLA typed argument or result since + we have no implementation materializing a variable of such type in + the caller. */ + if (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))) + && !poly_int_tree_p (TYPE_SIZE (TREE_TYPE (TREE_TYPE (fndecl) +return true; so that would mean adding && !DECL_BY_REFERENCE (DECL_RESULT (fndecl)) I suppose or looking at DECL_RESULT in the first place (which is a pointer in that case).
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org --- Comment #31 from Eric Botcazou --- > We talked about backporting the patches to GCC 10 with Richi on IRC today > and decided to wait for potential fallout even if we miss the 10.3 release. The fallout is major in Ada for the return part because the logic completely overlooks the CALL_EXPR_RETURN_SLOT_OPT flag; when it is set, you don't need to create a variable in the caller when inlining the function, so this works: procedure Inline22 (L, U : Integer) is type Arr is array (Integer range L .. U) of Boolean; function Get_Zero return Arr; pragma Inline_Always (Get_Zero); function Get_Zero return Arr is begin return (others => False); end; A : Arr; begin A := Get_Zero; end; eric@fomalhaut:~/install/gcc-10/bin/gcc -c inline22.adb eric@fomalhaut:~/install/gcc-11/bin/gcc -c inline22.adb inline22.adb: In function 'Inline22.Get_Zero': inline22.adb:10:3: error: function 'Inline22.Get_Zero' can never be inlined because it has a VLA return argument
[Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122 Richard Biener changed: What|Removed |Added Target Milestone|10.3|10.4 --- Comment #30 from Richard Biener --- GCC 10.3 is being released, retargeting bugs to GCC 10.4.
