bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
15 stars 9 forks source link

gcc13.1: Produced program run incorrectly #68

Closed alexalkis closed 1 year ago

alexalkis commented 1 year ago

prime.zip

With gcc13.1 finds 2 primes upto 1000000 :)

m68k-amigaos-gcc -O3 -mcrt=nix13 -o prime prime.c
vamos -v prime 1000000 1
23:16:48.885       main:   INFO:  done. exit code=0
23:16:48.885       main:   INFO:  total cycles: 78798
23:16:48.886       main:   INFO:  vamos is exiting
Counted 2 primes up to 2. (Run 1 times)

With gcc6 finds the correct number 78498

vamos -v prime 1000000 1
23:17:31.398       main:   INFO:  done. exit code=0
23:17:31.398       main:   INFO:  total cycles: 49823902
23:17:31.398       main:   INFO:  vamos is exiting
Counted 78498 primes up to 1000000. (Run 1 times)
bebbo commented 1 year ago

the conversion with atoi failed since an uninitialized ctype table was used. This could also happen with any compiler, depends only of the order of objects in the libnix libs...

alexalkis commented 1 year ago

works as expected now. Thanks!