Re: Coverity check please...

2025-01-20 Thread James Browning via devel
On Monday, January 20, 2025 3:39:37 PM Pacific Standard Time Hal Murray via devel wrote: > > Still seems like a bug to me. Any potential UB is bad. Should be easy > > to work around. > > Please look at the code. It's only 10 lines. > > If you can suggest a fix, I'll try it. > (I already tried

Re: Coverity check please...

2025-01-20 Thread Gary E. Miller via devel
Yo Hal! On Mon, 20 Jan 2025 15:39:37 -0800 Hal Murray wrote: > > Still seems like a bug to me. Any potential UB is bad. Should be > > easy to work around. > > Please look at the code. It's only 10 lines. I did. > If you can suggest a fix, I'll try it. Check for the underflow/overflow b

Re: Coverity check please...

2025-01-20 Thread Hal Murray via devel
> Still seems like a bug to me. Any potential UB is bad. Should be easy > to work around. Please look at the code. It's only 10 lines. If you can suggest a fix, I'll try it. (I already tried one from James.) -- These are my opinions. I hate spam. _

Re: Coverity check please...

2025-01-20 Thread Gary E. Miller via devel
Yo Hal! On Sun, 19 Jan 2025 21:17:17 -0800 Hal Murray wrote: > [I fatfingered something the first try and it didn't go to the list.] > > >> That assumes it goes around the loop a couple of times. But it > >> doesn't go around the loop even once -- or I'm confused. > > Gary said: > > While i

Re: Coverity check please...

2025-01-19 Thread Hal Murray via devel
[I fatfingered something the first try and it didn't go to the list.] >> That assumes it goes around the loop a couple of times. But it >> doesn't go around the loop even once -- or I'm confused. Gary said: > While is executed before forst loop iteration. Coverty doesn't complain until the 3rd

Re: Coverity check please...

2025-01-19 Thread Gary E. Miller via devel
Yo Hal! On Sun, 19 Jan 2025 20:18:52 -0800 Hal Murray wrote: > Gary said: > > Since j is 2, andi is 3, subtracting i from j caused integer wrap, > > which is undefined. > > That assumes it goes around the loop a couple of times. But it > doesn't go around the loop even once -- or I'm confus

Re: Coverity check please...

2025-01-19 Thread Hal Murray via devel
Gary said: > Since j is 2, andi is 3, subtracting i from j caused integer wrap, which > is undefined. That assumes it goes around the loop a couple of times. But it doesn't go around the loop even once -- or I'm confused. We get here with n=2 It looks to me like m gets initialized to 2. Do

Re: Coverity check please...

2025-01-19 Thread Gary E. Miller via devel
Yo Hal! On Sun, 19 Jan 2025 00:32:01 -0800 Hal Murray via devel wrote: > I think it's a bug in Coverity. Would somebody please check. I agree with coverity. > Is there a way to report bugs to Coverity? Or tell it not to check > something? Not that I know of, and we would need a bug first.

Re: Coverity check please...

2025-01-19 Thread Hal Murray via devel
> It looks like one to me. Thanks. > - m = n - (n * 4) / 10; > + m = n - ((n * 4) / 10); I wondered about that too. Seems unlikely, but ... So, I tried it. It didn't help. Anybody know how to report bugs to Coverity? I poked around a bit but didn't find it. -- These are my

Re: Coverity check please...

2025-01-19 Thread James Browning via devel
On Sunday, January 19, 2025 12:32:01 AM Pacific Standard Time Hal Murray via devel wrote: > I think it's a bug in Coverity. Would somebody please check. > > Is there a way to report bugs to Coverity? Or tell it not to check > something? It looks like one to me. I looked at the subject code and

Coverity check please...

2025-01-19 Thread Hal Murray via devel
I think it's a bug in Coverity. Would somebody please check. Is there a way to report bugs to Coverity? Or tell it not to check something? It's getting here with n =2 11. known_value_assign: j = n, its value is now 2. 471i = 0; j = n; 472m = n - (n * 4) / 10; (n*4)/10 is 0,