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

* Re: [PATCH] Fix note_defect3 function
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-06-13 13:50 UTC (permalink / raw)
  To: Akari Takahashi, gcc-patches



On 6/12/23 21:18, Akari Takahashi via Gcc-patches wrote:
> 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
Thanks.  Reviewing that file it looks like it was just supposed to be 
used for the sh5/sh5media processor.  My recollection is those were 
never actually produced and support for them was removed from GCC some 
time ago.  This file was missed during that removal.

Rather than apply the patch, I think the better choice is to just remove 
the divtab.cc file unless someone has a real use for it.

Is there a particular reason you were investigating the divtab.cc file?

jeff

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

* Re: [PATCH] Fix note_defect3 function
  2023-06-13 13:50 ` Jeff Law
@ 2023-06-13 19:13   ` Akari Takahashi
  0 siblings, 0 replies; 3+ messages in thread
From: Akari Takahashi @ 2023-06-13 19:13 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

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

Hi Jeff,

Thank you for your response. Regarding the divtab.cc file, I actually came
across it by accident while working on another task. I didn't have a
specific reason for investigating the file, but I noticed the issue and
thought it was worth bringing to your attention.

Thank you for taking care of this issue.

Best Regards,

Takahashi Akari

On Tue, Jun 13, 2023 at 10:50 PM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 6/12/23 21:18, Akari Takahashi via Gcc-patches wrote:
> > 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
> Thanks.  Reviewing that file it looks like it was just supposed to be
> used for the sh5/sh5media processor.  My recollection is those were
> never actually produced and support for them was removed from GCC some
> time ago.  This file was missed during that removal.
>
> Rather than apply the patch, I think the better choice is to just remove
> the divtab.cc file unless someone has a real use for it.
>
> Is there a particular reason you were investigating the divtab.cc file?
>
> jeff
>

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