J
jacob navia
As a consequence of a heavy discussion in another thread,
I wrote this program:
#include <stdlib.h>
int main(void)
{
char *p=calloc(65521,65552);
if (p)
printf("BUG!!!!\n");
}
The multiplication will give an erroneus result
in 32 bit size_t systems. I have tested this
in several systems with several compilers.
Maybe people with other compilers/implementations
would compile this program and send the results?
The results I have so far are:
LINUX
GCC 2.95
HAS THE BUG
GCC-4.02
NO BUGS
GCC-3.x
NO BUGS
WINDOWS
cygwin gcc 3.4.4
NO bugs
pelles c:
HAS THE BUG
Microsoft
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
NO BUGS (If the multiplication overflows it will trap. Very good
behavior)
AIX
IBM-cc (compiling in 32 bit mode)
NO BUGS
gcc 4.0.0 (compiling in 32 bit mode)
NO BUGS
Thanks in advance for your cooperation
I wrote this program:
#include <stdlib.h>
int main(void)
{
char *p=calloc(65521,65552);
if (p)
printf("BUG!!!!\n");
}
The multiplication will give an erroneus result
in 32 bit size_t systems. I have tested this
in several systems with several compilers.
Maybe people with other compilers/implementations
would compile this program and send the results?
The results I have so far are:
LINUX
GCC 2.95
HAS THE BUG
GCC-4.02
NO BUGS
GCC-3.x
NO BUGS
WINDOWS
cygwin gcc 3.4.4
NO bugs
pelles c:
HAS THE BUG
Microsoft
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
NO BUGS (If the multiplication overflows it will trap. Very good
behavior)
AIX
IBM-cc (compiling in 32 bit mode)
NO BUGS
gcc 4.0.0 (compiling in 32 bit mode)
NO BUGS
Thanks in advance for your cooperation