|
Message-ID: <20190215100527.GT21289@port70.net> Date: Fri, 15 Feb 2019 11:05:27 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Cc: "jounijl@...oo.co.uk" <jounijl@...oo.co.uk> Subject: Re: "Arithmetic exception" with modulus operator '%' * jounijl@...oo.co.uk <jounijl@...oo.co.uk> [2019-02-15 03:35:23 +0000]: > 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 undefined behaviour == anything can happen the compiler can drop this entirely. > ----- /snip ----- > > The variables have some values other than 0. > > The environment is: > The Alpine Linux is installed in Oracle Virtualbox in FreeBSD 12, 64-bit > Intel. x86_64 traps mod by 0 (in case the compiler didn't drop the code path because of ub). > > $ uname -a > Linux localhost 4.14.89-0-vanilla #1-Alpine SMP Tue Dec 18 16:10:10 UTC 2018 > x86_64 GNU/Linux > > $ clang --version > Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) > > What does this? Do I need to include some library? what behaviour do you expect? > > w.b.reg., Jouni
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.