Mantis - ALGLIB
Viewing Issue Advanced Details
1025 General minor have not tried 2024-01-29 18:04 2024-04-11 18:54
barracuda156  
 
normal  
new 4.01.0  
open  
none    
none  
C++
0001025: alglib makes a wrong assumption for size of bool: is may not be 1 byte
The code assumes 1-byte bool, which is wrong for some platforms.

[ 26%] Building CXX object CMakeFiles/alglib.dir/src/ap.cpp.o
/usr/bin/g++-4.2 -Dalglib_EXPORTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_alglib/alglib/work/alglib-cpp/src -pipe -Os -DNDEBUG -I/opt/local/include -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT CMakeFiles/alglib.dir/src/ap.cpp.o -MF CMakeFiles/alglib.dir/src/ap.cpp.o.d -o CMakeFiles/alglib.dir/src/ap.cpp.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_alglib/alglib/work/alglib-cpp/src/ap.cpp
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_alglib/alglib/work/alglib-cpp/src/ap.cpp:294: error: size of array ‘_ae_bool_must_be_8_bits_wide’ is negative
Darwin ppc has 4-byte bool.
log file icon alglib_ppc.log [^] (19,679 bytes) 2024-01-29 18:06
Issue History
2024-01-29 18:04 barracuda156 New Issue
2024-01-29 18:04 barracuda156 Programming language => C++
2024-01-29 18:06 barracuda156 File Added: alglib_ppc.log
2024-01-29 18:08 barracuda156 Note Added: 0012035
2024-01-29 18:17 barracuda156 Note Added: 0012036
2024-01-29 18:22 barracuda156 Note Added: 0012037
2024-04-11 18:54 SergeyB Target Version => 4.02.0

Notes
(0012035)
barracuda156   
2024-01-29 18:08   
P. S. I apologize for an accidental duplicate, it is a result of network error, I got a Bad gateway page and re-submitted the issue, however turned out it already got submitted despite the error message.

Please close http://bugs.alglib.net/view.php?id=1026 as a duplicate.
(0012036)
barracuda156   
2024-01-29 18:17   
Given that comment to the code explicitly state these asserts can be just removed, perhaps either remove it or at least do this:

#ifndef __ppc__
static char _ae_bool_must_be_8_bits_wide [1-2*((int)(sizeof(ae_bool))-1)*((int)(sizeof(ae_bool))-1)];
#endif
(0012037)
barracuda156   
2024-01-29 18:22   
And then below:

void ae_never_call_it()
{
#ifndef __ppc__
    ae_touch_ptr((void*)_ae_bool_must_be_8_bits_wide);
#endif
    ae_touch_ptr((void*)_ae_int32_t_must_be_32_bits_wide);
    ae_touch_ptr((void*)_ae_int64_t_must_be_64_bits_wide);
    ae_touch_ptr((void*)_ae_uint64_t_must_be_64_bits_wide);
    ae_touch_ptr((void*)_ae_int_t_must_be_pointer_sized);
}