One question on the source code of tree-object-size.cc

Qing Zhao qing.zhao@oracle.com
Mon Jul 31 16:47:18 GMT 2023


Hi, Sid and Jakub,

I have a question in the following source portion of the routine “addr_object_size” of gcc/tree-object-size.cc:

 743       bytes = compute_object_offset (TREE_OPERAND (ptr, 0), var);
 744       if (bytes != error_mark_node)
 745         {
 746           bytes = size_for_offset (var_size, bytes);
 747           if (var != pt_var && pt_var_size && TREE_CODE (pt_var) == MEM_REF)
 748             {
 749               tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0),
 750                                                    pt_var);
 751               if (bytes2 != error_mark_node)
 752                 {
 753                   bytes2 = size_for_offset (pt_var_size, bytes2);
 754                   bytes = size_binop (MIN_EXPR, bytes, bytes2);
 755                 }
 756             }
 757         }

At line 754, why we always use “MIN_EXPR” whenever it’s for OST_MINIMUM or not? 
Shall we use 

(object_size_type & OST_MINIMUM
                            ? MIN_EXPR : MAX_EXPR)

Instead?

Thanks a lot for the help.

Qing


More information about the Gcc-patches mailing list