public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Akari Takahashi <akaritakahashioss@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix note_defect3 function
Date: Tue, 13 Jun 2023 12:18:54 +0900	[thread overview]
Message-ID: <CAPzzfctOqwsbG4ig4gT2eUWc5C+YdLZPJfKtHDgN8OKSQU+PzA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

Hello,

I've noticed an issue with the note_defect3 function and have prepared a
patch to fix it. The function is missing a return statement, which is
causing undefined behavior. This patch adds the missing return statement,
ensuring that the function returns the correct value.

Please consider applying this patch to correct the issue. Thank you.

Best regards,

Takahashi Akari

---
diff --git a/gcc/config/sh/divtab.cc b/gcc/config/sh/divtab.cc
index 30d57f2a1dd..cd3e709e3ab 100644
--- a/gcc/config/sh/divtab.cc
+++ b/gcc/config/sh/divtab.cc
@@ -75,12 +75,13 @@ note_defect3 (int val, double d2, double y2d, double x)
   if (defect < min_defect3)
     {
       min_defect3 = defect;
       min_defect3_x = x;
       min_defect3_val = val;
     }
+  return defect;
 }

 /* This function assumes 32-bit integers.  */
 static double
 calc_defect (double x, int constant, int factor)
 {
---

             reply	other threads:[~2023-06-13  3:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  3:18 Akari Takahashi [this message]
2023-06-13 13:50 ` Jeff Law
2023-06-13 19:13   ` Akari Takahashi

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=CAPzzfctOqwsbG4ig4gT2eUWc5C+YdLZPJfKtHDgN8OKSQU+PzA@mail.gmail.com \
    --to=akaritakahashioss@gmail.com \
    --cc=gcc-patches@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).