mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: bootstrap-linux patches for cross compilation to arm
Date: Mon, 30 Jul 2012 00:21:17 -0400	[thread overview]
Message-ID: <20120730042117.GW544@brightrain.aerifal.cx> (raw)
In-Reply-To: <CA+wkPBR9d7=szw_h5O6xCsgRjrZLsGAwTXf9_U-eM98zU-9tuQ@mail.gmail.com>

On Mon, Jul 30, 2012 at 11:14:46AM +1000, James Bond wrote:
> > This is stupid; there's no reason for the division to raise signals or
> > generate exceptions. Integer division by zero results in undefined
> >  [...]
> 
> Agreed.
> 
> A few people have been hit by this problem, I found at least two here:
> - earlier problem (2009) with proposed hack
> http://gcc.gnu.org/ml/gcc-help/2009-10/msg00332.html
> - more recent problem (2012) with proposed patches
> http://comments.gmane.org/gmane.comp.gcc.help/41025
> 
> The patch involves disabling exception in libgcc's libunwind. However I'm
> not qualified to judge the correctness or suitability of these patches for
> general purpose as they are targetting bare metal, while for our case we
> are targetting musl.

The patch seems correct or at least suitable as a workaround. It looks
like this is a bug in gcc's code generation for arm; with exceptions
enabled, it seems to be generating code to throw an exception for
division by zero. There's no reason this should be done; integer
division by zero is UB not an exception you can catch and handle (even
in C++).

Rich


      reply	other threads:[~2012-07-30  4:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-28 12:18 James Bond
2012-07-28 12:54 ` Rich Felker
2012-07-28 13:54   ` John Spencer
2012-07-28 14:42   ` James Bond
2012-07-28 20:37     ` Rich Felker
2012-07-30  1:14       ` James Bond
2012-07-30  4:21         ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120730042117.GW544@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).