poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug default/30778] New: `in` in conditionals might be too strict


From: mh-sourceware at glandium dot org
Subject: [Bug default/30778] New: `in` in conditionals might be too strict
Date: Fri, 18 Aug 2023 07:01:44 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30778

            Bug ID: 30778
           Summary: `in` in conditionals might be too strict
           Product: poke
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: unassigned at sourceware dot org
          Reporter: mh-sourceware at glandium dot org
                CC: poke-devel at gnu dot org
  Target Milestone: ---

I was doing something like this:

```
(poke) load elf
(poke) var elf = Elf64_File @ 0#B
(poke) var dyn = elf.get_sections_by_type(ELF_SHT_DYNAMIC)[0]
(poke) var dyn = Elf64_Dyn[dyn.sh_size / dyn.sh_entsize] @ dyn.sh_offset
(poke) for (d in dyn) if (d.d_tag in
[ELF_DT_RELR,ELF_DT_RELRSZ,ELF_DT_RELRENT]) printf "%v\n", d
```

And that fails with:

```
<stdin>:1:20: error: invalid operand in expression
<stdin>:1:20: error: expected uint<32>, got Elf64_Sxword
```

This however works:
```
(poke) for (d in dyn) if (d.d_tag == ELF_DT_RELR || d.d_tag == ELF_DT_RELRSZ ||
d.d_tag == ELF_DT_RELRENT) printf "%v\n", d
Elf64_Dyn {d_tag=36L,d_data=struct {d_val=1144UL}}
Elf64_Dyn {d_tag=35L,d_data=struct {d_ptr=16UL#B}}
Elf64_Dyn {d_tag=37L,d_data=struct {d_ptr=8UL#B}}
```

Adding `as Elf64_Sxword` to each item in the array also works, but it's
heavyweight.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]