https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103537
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2021-12-03
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hedayat Vatankhah from comment #2)
> With these options, the code runs a bit more but still crashes.
Right those options are supposed to be used to catch issues in your code.
> The output
> of each option is given below:
>
> Output with -fsanitize=undefined:
> /home/hedayat/Projects/powerfake/powerfake.h:257:40: runtime error: load of
> misaligned address 0x00000044c556 for type '<unknown> *', which requires 8
> byte alignment
> 0x00000044c556: note: pointer points here
> 00 e8 ac 5a 00 00 84 c0 74 17 48 8d 55 f4 48 8d 45 f8 48 89 c6 bf 00 5c
> 4b 00 e8 17 5b 00 00 eb
> ^
> zsh: segmentation fault (core dumped) ./sample/samples
Can you check the above part of the problem.
template <typename FuncType>
remove_func_cv_t<FuncType> unify_pmf(FuncType f)
{
return reinterpret_cast<remove_func_cv_t<FuncType>>(f);
}
This looks like it could cause issues.
So does:
return std::make_pair(reinterpret_cast<void *>(func_ptr),
std::type_index(typeid(FuncType)));
I get the feeling you don't understand how pointer to member functions work in
some cases.