mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 09:58:34 +00:00
Core: Dereference a pointer wherever a number is wanted, not only in operands
return p and p + 1 on a map lookup worked, because they go through get_typed_operand, which loads through the pointer with a null check. r.val = p, x = p into an integer local, and c_int64(p) (so also return c_int64(p)) did not: those three sites call eval_expr directly and handed the pointer to the integer path, failing with i64* vs i64. deref_to_value is get_typed_operand's pointer fallback as a helper, used by it and by the three sites, only when the destination is an integer: a pointer slot still aliases (q = p), and an opaque pointer, which names no pointee, is left alone. The descriptor takes the map's declared value ctype, as the operand path does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from .expr_pass import eval_expr, handle_expr, get_typed_operand
|
||||
from .expr_pass import eval_expr, handle_expr, get_typed_operand, deref_to_value
|
||||
from .type_normalization import (
|
||||
convert_to_bool,
|
||||
get_base_type_and_depth,
|
||||
@ -20,6 +20,7 @@ __all__ = [
|
||||
"canonicalise",
|
||||
"to_promoted",
|
||||
"get_typed_operand",
|
||||
"deref_to_value",
|
||||
"usual_arithmetic_conversions",
|
||||
"get_base_type_and_depth",
|
||||
"deref_to_depth",
|
||||
|
||||
Reference in New Issue
Block a user