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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-08-21
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|Miscompilation with UBSAN   |Miscompilation and missing
                   |with pointer to member      |bounds check with UBSAN
                   |functions and array         |with pointer to member
                   |accesses                    |functions and array
                   |                            |accesses

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

A related issue is a missing bounds check on parr[c] with:
```
struct C
{
        void P(int);
        void IP();
        int parr[16];
};

typedef void (C::*fp)();

typedef struct arr_t
{
         fp func;
} arr_t;

static arr_t farr[1] =
{
        { &C::IP },
};

int f(int a) { return a; }

void C::P(int c)
{
        ((*this).*farr[f(parr[c])].func)();
}

```

Reply via email to