public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Deepthi Bokka <dbokka@in.autorobinc.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Divide by Zero segment fault
Date: Thu, 18 Oct 2012 01:44:00 -0000	[thread overview]
Message-ID: <9843D313A3D30048BAAC430B437718BE5CDB9BE8@ADC.in.autorobinc.com> (raw)

Hi,

I am new to this group and I am working on a project where I am porting the Diab build ECU software to GCC 3.4.4 version. This software actually works on MPC555 series of processor but I am removing all the hardware dependencies and creating the exe and dll so that it can run on Windows XP system. The dll will run on a proprietary tool to simulate the results.

But when I am running exe or dll, I am getting a segmentation fault because of divide by zero. To check for divide by zero in the software, code is very huge with many files and there are multiple places where this can occur. So checking for zero and skipping that is ruled out for my case.

But when the diab build software is running on MPC555 we are not getting this issue as there the compiler is handled differently. For example:
x = a/b where b=0 then this is processed as x=0 rather than giving error. So something by zero is treated as simply zero.

I want similar functionality even in GCC build code, is there any option for doing this. I tried the flag  -mno-check-zero-division in make file but I was getting make file error that this is not a valid flag. I tried using the signal handling "sigaction" but could not get the exact functionality as x/0 should be treated as 0. 

Please can any one help me how to handle this scenario, I can upgrade the GCC compiler version if higher versions can handle this issue. 

-Deepthi

             reply	other threads:[~2012-10-17  5:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  1:44 Deepthi Bokka [this message]
2012-10-18 18:06 ` Andrew Haley

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=9843D313A3D30048BAAC430B437718BE5CDB9BE8@ADC.in.autorobinc.com \
    --to=dbokka@in.autorobinc.com \
    --cc=gcc-help@gcc.gnu.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).