Ticket #716 (closed patch: fixed)
[PATCH] Remove incorrect check for function pointer alignment
|Reported by:||doughera||Owned by:|
Configure.pl currently sets HAS_aligned_funcptr if the user is using gcc (but not on HPUX). The only place it is used is src/multidispatch.c, which checks if the func_ptr & 3 == 0.
This is wrong on several fronts. First, other compilers/architectures/operating systems can certainly use aligned function pointers. Second, the number '3' is, in general, wrong. Gcc's -faligned-functions[=n] option can take a variety of 'n' values (and can implicitly be set to different values by other options, such as -O[n].) The Configure.pl setting ignores all that.
If we really cared about the exact number, we should write a Configure test to actually measure the alignment using the full set of compiler flags that will be used to build parrot. The ASSERT in src/multidispatch.c would then be altered to use the measured alignment number.
Failing that, however, it makes sense to just delete the inaccurate ASSERT and the corresponding Configure.pl stuff. The attached patch does just that.