public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix note_defect3 function
@ 2023-06-13  3:18 Akari Takahashi
  2023-06-13 13:50 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Akari Takahashi @ 2023-06-13  3:18 UTC (permalink / raw)
  To: gcc-patches

[-- 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)
 {
---

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-13 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13  3:18 [PATCH] Fix note_defect3 function Akari Takahashi
2023-06-13 13:50 ` Jeff Law
2023-06-13 19:13   ` Akari Takahashi

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).