Re: Help with integer division overflow issue

Jason Thorpe <[email protected]> Fri, 12 Jan 2024 07:11:08 -0800
Newsgroups gmane.os.netbsd.ports.m68k
Message-ID <[email protected]>
> On Jan 12, 2024, at 3:20 AM, Izumi Tsutsui <[email protected]> wrote:
> 
> # cc -o test-ccr test-ccr.c
> # ./test-ccr
> val = -2147483648 (0x80000000)
> ccr = 0x80000008
> # 

Wait, WAAAT?

So, not only is the V flag not set, but N is set (yah, I guess the result is negative, but it should have overflowed!) and some random upper bit in the “int ccr;” variable is set???

Help me to understand!

(At least the 68020 and 68030 behave the same way, I guess.)

-- thorpej