aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-05-28 19:18:37 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-06-03 12:41:20 +0200
commite26b748a62e5bc59f6671faab75f737503c87319 (patch)
tree608cb78d94fa4cfef5b80576636720c70edab601 /gcc/tree-inline.c
parentd9a83b99349071e1c6e78df7fea3424338390d5e (diff)
downloadgcc-e26b748a62e5bc59f6671faab75f737503c87319.zip
gcc-e26b748a62e5bc59f6671faab75f737503c87319.tar.gz
gcc-e26b748a62e5bc59f6671faab75f737503c87319.tar.bz2
Fix signedness issue in DWARF functions (1)
The compiler can synthesize DWARF functions to describe the location and size of components in discriminated record types with variant part in Ada, but a limitation is that most quantities must have DWARF2_ADDR_SIZE or else be the result of a zero-extension to DWARF2_ADDR_SIZE of a smaller quantity, as documented in loc_list_from_tree_1: /* ??? Most of the time we do not take proper care for sign/zero extending the values properly. Hopefully this won't be a real problem... */ In Ada discriminants may be either signed or unsigned, so this limitation is problematic. Therefore the attached patch adds a strict_signedness field to the loc_descr_context that is passed around in parts of the DWARF back-end and changes loc_list_from_tree_1 to act upon it being set to true. It also contains an optimization to avoid emitting useless comparisons. gcc/ * dwarf2out.c (scompare_loc_descriptor): Fix head comment. (is_handled_procedure_type): Likewise. (struct loc_descr_context): Add strict_signedness field. (resolve_args_picking_1): Deal with DW_OP_[GNU_]deref_type, DW_OP_[GNU_]convert and DW_OP_[GNU_]reinterpret. (resolve_args_picking): Minor tweak. (function_to_dwarf_procedure): Initialize strict_signedness field. (type_byte_size): Likewise. (field_byte_offset): Likewise. (gen_descr_array_type_die): Likewise. (gen_variant_part): Likewise. (loc_list_from_tree_1) <CALL_EXPR>: Tidy up and set strict_signedness to true when a context is present before evaluating the arguments. <COND_EXPR>: Do not generate a useless comparison with zero. When dereferencing an address, if strict_signedness is true and the type is small and signed, use DW_OP_deref_type to do the dereference and then DW_OP_convert to convert back to the generic type.
Diffstat (limited to 'gcc/tree-inline.c')
0 files changed, 0 insertions, 0 deletions