|
Message-ID: <20190214235814.GY23599@brightrain.aerifal.cx> Date: Thu, 14 Feb 2019 18:58:14 -0500 From: Rich Felker <dalias@...c.org> To: "jounijl@...oo.co.uk" <jounijl@...oo.co.uk> Cc: musl@...ts.openwall.com Subject: Re: "Arithmetic exception" with modulus operator '%' On Fri, Feb 15, 2019 at 03:35:23AM +0000, jounijl@...oo.co.uk wrote: > > As in the headline. Program stops and prints "Arithmetic exception" > at the line where the modulus operator '%' is. > > I'm compiling in Alpine linux with clang installed from apk:s: > > clang -c test.c > clang -o test test.o > > The code is: > > ----- snip ----- > unsigned int unum = 0; > unsigned int umod = 0; > unsigned int ures = 0; > ures = unum % umod; // <-- this one > ----- /snip ----- > > The variables have some values other than 0. I don't follow. You say they have some value other than 0, but the above example snippet has them as zero, and if they're 0 it's undefined behavior and a fault of some sort is a typical result. What did you expect to happen? Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.