[Bug middle-end/103984] [12 regression] Possible maybe-uninitialized false positive on shaderc-2021.0 since r12-6329-g4f6bc28fc7dd86bd

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 15 15:55:03 GMT 2022


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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What the gimplifier sees is:
 <target_expr 0x7fffe8f61a48
    type <record_type 0x7fffe8f0bd20 Z addressable needs-constructing cxx-odr-p
type_4 type_5 type_6 BLK
        size <integer_cst 0x7fffe9dd8840 constant 320>
        unit-size <integer_cst 0x7fffe9dd8888 constant 40>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe8f0bd20
        fields <function_decl 0x7fffe8dfad00 operator= type <method_type
0x7fffe8a07690>
            addressable used public external autoinline decl_3 QI
pr103984.C:21:8 align:16 warn_if_not_align:0 context <record_type
0x7fffe8f0bd20 Z>
            full-name "Z& Z::operator=(Z&&) noexcept"
            not-really-extern chain <function_decl 0x7fffe8dfac00 operator=>>
context <translation_unit_decl 0x7fffea24c168 pr103984.ii>
        full-name "struct Z"
        needs-constructor needs-destructor X() X(constX&) this=(X&) n_parents=0
use_template=0 interface-unknown
        pointer_to_this <pointer_type 0x7fffe8f0f690> reference_to_this
<reference_type 0x7fffe8f0f9d8> chain <type_decl 0x7fffe8f0c558 Z>>
    side-effects addressable
    arg:0 <var_decl 0x7fffe8e3f510 D.31524 type <record_type 0x7fffe8f0bd20 Z>
        addressable used ignored read BLK pr103984.C:32:3 size <integer_cst
0x7fffe9dd8840 320> unit-size <integer_cst 0x7fffe9dd8888 40>
        align:64 warn_if_not_align:0 context <function_decl 0x7fffe8f0e000
main>>
    arg:1 <statement_list 0x7fffe8e860c0
        type <void_type 0x7fffea25ff18 void type_6 VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea25ff18
            pointer_to_this <pointer_type 0x7fffea267000>>
        side-effects head 0x7fffe8e73660 tail 0x7fffe8e73780 stmts
0x7fffe8e860e0 0x7fffe8f61af0 0x7fffe8e861a0 0x7fffe8e3b758

        stmt <expr_stmt 0x7fffe8e860e0 type <void_type 0x7fffea25ff18 void>
            side-effects
            arg:0 <init_expr 0x7fffe8e3b708 type <record_type 0x7fffea4010a8
string>
                side-effects
                arg:0 <component_ref 0x7fffe95572d0 type <record_type
0x7fffea4010a8 string>
                    arg:0 <var_decl 0x7fffe8e3f510 D.31524> arg:1 <field_decl
0x7fffe8f0c688 name>>
                arg:1 <target_expr 0x7fffe8f618f8 type <record_type
0x7fffea4010a8 string>
                    side-effects tree_0 arg:0 <var_decl 0x7fffe8e3f360 D.31522>
                    arg:1 <aggr_init_expr 0x7fffe8f61888 type <void_type
0x7fffea25ff18 void>
                        side-effects
                        arg:0 <integer_cst 0x7fffea2611b0 constant 4>
                        arg:1 <addr_expr 0x7fffe8e7c600 type <pointer_type
0x7fffe8f67540>
                            constant arg:0 <function_decl 0x7fffe8f04400 str>>
arg:2 <var_decl 0x7fffe8e3f360 D.31522>
                        arg:3 <addr_expr 0x7fffe8e7c5c0 type <pointer_type
0x7fffe8ed7dc8>
                            readonly arg:0 <var_decl 0x7fffe8e3f120 arg>
                            pr103984.C:30:7 start: pr103984.C:30:7 finish:
pr103984.C:30:9>>
                    arg:2 <call_expr 0x7fffe8f618c0 type <void_type
0x7fffea25ff18 void>
                        side-effects nothrow
                        fn <addr_expr 0x7fffe8e7c6a0 type <pointer_type
0x7fffe95c30a8>
                            constant arg:0 <function_decl 0x7fffe95aa200
__dt_comp >>
                        arg:0 <addr_expr 0x7fffe8e7c660 type <pointer_type
0x7fffe95bf930>
                            arg:0 <var_decl 0x7fffe8e3f360 D.31522>>>
                    pr103984.C:30:14 start: pr103984.C:30:7 finish:
pr103984.C:30:15>>
            pr103984.C:35:1 start: pr103984.C:35:1 finish: pr103984.C:35:1>
        stmt <target_expr 0x7fffe8f61af0 type <boolean_type 0x7fffea25fb28
bool>
            side-effects static arg:0 <var_decl 0x7fffe8e3f5a0 D.31544>
            arg:1 <integer_cst 0x7fffea2612d0 constant 1>
            arg:2 <cond_expr 0x7fffe9557390 type <void_type 0x7fffea25ff18
void>
                side-effects arg:0 <var_decl 0x7fffe8e3f5a0 D.31544>
                arg:1 <call_expr 0x7fffe8f61ab8 type <void_type 0x7fffea25ff18
void>
                    side-effects nothrow
                    fn <addr_expr 0x7fffe8e86180 type <pointer_type
0x7fffe95c30a8>
                        constant arg:0 <function_decl 0x7fffe95aa200 __dt_comp
>>
                    arg:0 <addr_expr 0x7fffe8e86140 type <pointer_type
0x7fffe95bf930>

                        arg:0 <component_ref 0x7fffe8a35300 type <record_type
0x7fffea4010a8 string>
                            arg:0 <var_decl 0x7fffe8e3f510 D.31524> arg:1
<field_decl 0x7fffe8f0c688 name>>>>
                arg:2 <void_cst 0x7fffea252c60 type <void_type 0x7fffea25ff18
void>
                    constant>>
            pr103984.C:35:1 start: pr103984.C:35:1 finish: pr103984.C:35:1>
        stmt <expr_stmt 0x7fffe8e861a0 type <void_type 0x7fffea25ff18 void>
            side-effects
            arg:0 <init_expr 0x7fffe8e3b730 type <integer_type 0x7fffea25f5e8
int>
                side-effects
                arg:0 <component_ref 0x7fffe95573c0 type <integer_type
0x7fffea25f5e8 int>
                    arg:0 <var_decl 0x7fffe8e3f510 D.31524> arg:1 <field_decl
0x7fffe8f0c720 stage>>
                arg:1 <call_expr 0x7fffe8f61968 type <integer_type
0x7fffea25f5e8 int>
                    side-effects
                    fn <addr_expr 0x7fffe8e7c840 type <pointer_type
0x7fffe8f67738>
                        constant arg:0 <function_decl 0x7fffe8f0af00 to_stage>>
                    arg:0 <addr_expr 0x7fffe8e7c820 type <reference_type
0x7fffe8f0bf18>
                        side-effects
                        arg:0 <target_expr 0x7fffe8f61930 type <record_type
0x7fffe8ed7690 string_piece>
                            side-effects tree_0 arg:0 <var_decl 0x7fffe8e3f480
D.31523> arg:1 <aggr_init_expr 0x7fffe8f51f80>>>
                    pr103984.C:31:15 start: pr103984.C:31:7 finish:
pr103984.C:31:19>>
            pr103984.C:35:1 start: pr103984.C:35:1 finish: pr103984.C:35:1>
        stmt <modify_expr 0x7fffe8e3b758 type <boolean_type 0x7fffea25fb28
bool>
            side-effects arg:0 <var_decl 0x7fffe8e3f5a0 D.31544>
            arg:1 <integer_cst 0x7fffea2612a0 constant 0>
            pr103984.C:35:1 start: pr103984.C:35:1 finish: pr103984.C:35:1>>
    arg:2 <call_expr 0x7fffe8f61b28 type <void_type 0x7fffea25ff18 void>
        side-effects nothrow
        fn <addr_expr 0x7fffe8e7cda0 type <pointer_type 0x7fffe8f67e70>
            constant arg:0 <function_decl 0x7fffe8f66b00 __dt_comp >>
        arg:0 <addr_expr 0x7fffe8e7c8a0 type <pointer_type 0x7fffe8f0f690>
            arg:0 <var_decl 0x7fffe8e3f510 D.31524>>>
    pr103984.C:29:28 start: pr103984.C:29:28 finish: pr103984.C:32:3>

i.e. the ~Z (&D.31524) is a cleanup is outer, while the ~string (&D.31524.name)
cleanup is on an TARGET_EXPR inside of it (the one with D.31544 var).
But the inner TARGET_EXPR has CLEANUP_EH_ONLY set on it, while the outer one
(with D.31524 var) doesn't.
Jason, is there any way how to arrange for such cases (with help of the C++ FE,
say with some new flag on something or just pure gimplifier) to defer the
D.31524 clobber only to outside of where the eh only cleanup is handled (that
is on the enclosing CLEANUP_POINT_EXPR, right?)?


More information about the Gcc-bugs mailing list