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

--- Comment #7 from Kirill Chilikin <chilikin.k at gmail dot com> ---
(In reply to anlauf from comment #6)
> But what I do not understand is why gfc_conv_expr thinks the function is 
> tree_constant.
The flag assignment happens here:

(gdb) l
5163          tc = false;
5164          se |= TREE_SIDE_EFFECTS (node);
5165        }
5166    
5167    
5168      TREE_CONSTANT (t) = tc;
5169      TREE_SIDE_EFFECTS (t) = se;
5170    #undef UPDATE_FLAGS
5171    }
5172    
(gdb) p tc
$42 = true
(gdb) p node.function_decl.common.common.common.common.common.name.identifier 
$43 = {common = {typed = {base = {code = IDENTIFIER_NODE,
        side_effects_flag = 0, constant_flag = 0, addressable_flag = 0,
        volatile_flag = 0, readonly_flag = 0, asm_written_flag = 0,
        nowarning_flag = 0, visited = 0, used_flag = 0, nothrow_flag = 0,
        static_flag = 0, public_flag = 0, private_flag = 0,
        protected_flag = 0, deprecated_flag = 0, default_def_flag = 0, u = {
          bits = {lang_flag_0 = 0, lang_flag_1 = 0, lang_flag_2 = 0,
            lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0,
            lang_flag_6 = 0, saturating_flag = 0, unsigned_flag = 0,
            packed_flag = 0, user_align = 0, nameless_flag = 0,
            atomic_flag = 0, unavailable_flag = 0, spare0 = 0, spare1 = 0,
            address_space = 0}, int_length = {unextended = 0, extended = 0},
          length = 0, vector_cst = {log2_npatterns = 0, nelts_per_pattern = 0,
            unused = 0}, version = 0, chrec_var = 0, ifn = IFN_CRC,
          omp_atomic_memory_order = OMP_MEMORY_ORDER_UNSPECIFIED,
          dependence_info = {clique = 0, base = 0}}}, type = 0x0},
    chain = 0x0}, id = {str = 0x7ffff727f230 "s1", len = 2, hash_value = 72}}
(gdb) backtrace
#0  recompute_tree_invariant_for_addr_expr (t=0x7ffff700d680) at
../../gcc/gcc/tree.cc:5168
#1  0x0000000001eccfce in build1 (code=ADDR_EXPR, type=0x7ffff700a0a8,
node=0x7ffff6fff800) at ../../gcc/gcc/tree.cc:5240
#2  0x00000000010e744f in build1_loc (loc=577792, code=ADDR_EXPR,
type=0x7ffff700a0a8, arg1=0x7ffff6fff800) at ../../gcc/gcc/tree.h:4895
#3  0x00000000014c5398 in fold_build1_loc (loc=577792, code=ADDR_EXPR,
type=0x7ffff700a0a8, op0=0x7ffff6fff800) at ../../gcc/gcc/fold-const.cc:13896
#4  0x00000000010df606 in gfc_build_addr_expr (type=0x0, t=0x7ffff6fff800) at
../../gcc/gcc/fortran/trans.cc:379
#5  0x0000000001146463 in gfc_conv_variable (se=0x7fffffffcff0, expr=0x4cbee30)
at ../../gcc/gcc/fortran/trans-expr.cc:3272
#6  0x0000000001160f74 in gfc_conv_expr (se=0x7fffffffcff0, expr=0x4cbee30) at
../../gcc/gcc/fortran/trans-expr.cc:10565
#7  0x00000000011613b5 in gfc_conv_expr_reference (se=0x7fffffffcff0,
expr=0x4cbee30) at ../../gcc/gcc/fortran/trans-expr.cc:10688
#8  0x000000000118c401 in conv_isocbinding_function (se=0x7fffffffcff0,
expr=0x4cbef20) at ../../gcc/gcc/fortran/trans-intrinsic.cc:9867
#9  0x00000000011915cb in gfc_conv_intrinsic_function (se=0x7fffffffcff0,
expr=0x4cbef20) at ../../gcc/gcc/fortran/trans-intrinsic.cc:11234
#10 0x000000000115c931 in gfc_conv_function_expr (se=0x7fffffffcff0,
expr=0x4cbef20) at ../../gcc/gcc/fortran/trans-expr.cc:9338
#11 0x0000000001160f44 in gfc_conv_expr (se=0x7fffffffcff0, expr=0x4cbef20) at
../../gcc/gcc/fortran/trans-expr.cc:10557
#12 0x00000000011615d9 in gfc_conv_expr_reference (se=0x7fffffffcff0,
expr=0x4cbef20) at ../../gcc/gcc/fortran/trans-expr.cc:10723
#13 0x0000000001154bec in gfc_conv_procedure_call (se=0x7fffffffd930,
sym=0x4cb9000, args=0x4cb9620, expr=0x0, append_args=0x0) at
../../gcc/gcc/fortran/trans-expr.cc:7447
#14 0x00000000011d2589 in gfc_trans_call (code=0x4cbf010,
dependency_check=false, mask=0x0, count1=0x0, invert=false) at
../../gcc/gcc/fortran/trans-stmt.cc:495
#15 0x00000000010e672a in trans_code (code=0x4cbf010, cond=0x0) at
../../gcc/gcc/fortran/trans.cc:2423
#16 0x00000000010e6bfd in gfc_trans_code (code=0x4cbeb90) at
../../gcc/gcc/fortran/trans.cc:2715
#17 0x0000000001137949 in gfc_generate_function_code (ns=0x4cf8c20) at
../../gcc/gcc/fortran/trans-decl.cc:8233
#18 0x00000000010e6c41 in gfc_generate_code (ns=0x4cf8c20) at
../../gcc/gcc/fortran/trans.cc:2732
#19 0x000000000105a940 in translate_all_program_units
(gfc_global_ns_list=0x4c7a640) at ../../gcc/gcc/fortran/parse.cc:7569
#20 0x000000000105b28e in gfc_parse_file () at
../../gcc/gcc/fortran/parse.cc:7899
#21 0x00000000010cc342 in gfc_be_parse_file () at
../../gcc/gcc/fortran/f95-lang.cc:247
#22 0x0000000001a75f82 in compile_file () at ../../gcc/gcc/toplev.cc:455
#23 0x0000000001a7950c in do_compile () at ../../gcc/gcc/toplev.cc:2225
#24 0x0000000001a7997f in toplev::main (this=0x7fffffffdefa, argc=7,
argv=0x7fffffffe028) at ../../gcc/gcc/toplev.cc:2390
#25 0x0000000003809dd4 in main (argc=7, argv=0x7fffffffe028) at
../../gcc/gcc/main.cc:39

Reply via email to