NO

Author Topic: Variable changes in between functions (out of bounds?)  (Read 13994 times)

CommonTater

  • Guest
Re: Variable changes in between functions (out of bounds?)
« Reply #30 on: April 01, 2012, 12:06:01 PM »
Tater I meant that it's a huge job to trace puntually each memory read and write. And it's not worth of because it is well known, it relates also to buffer overflow techniques used by virus.

A huge job that right now I wouldn't know where to begin... I used to do quite a bit of ASM for Z-80 in cashregisters but that was so specialized that almost none of it carries over to general purpose programming and I've let the skill atropy over the years.  Thing is the kind of work I do just never seems to take me back to it.  I do know some about buffer overflow tricks and such, but probably not as much as I should.

Quote
In my years of system code programming, more than 20, this is engraved in my mind.
So at the end there is no bug at all in generated code. Anyway not using optimization with this compiler is like to drive a Ferrari using only the first gear 

Now maybe it's the kind of code I write or maybe it's the way I write it... but I've never been able to spot any significant difference between optimizations off or on ... I use mainly Windows API calls, even in console mode, and tend to use pre-written API functions before writing my own, so maybe I've just never gotten into any situation where it would make a noteworthy difference. 

The optimizer bugs are very real, I've posted code in the "Bug Reports" section that demonstrates them. This is a big deal to me because what I do very often messes very deeply with people's data and I tend to favour caution over performance. 

I suppose I should grab a spare morning and do some testing to see how much difference it actually makes...

Thanks for your input on this, my friend... very interesting stuff.  8)
« Last Edit: April 01, 2012, 12:13:11 PM by CommonTater »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Variable changes in between functions (out of bounds?)
« Reply #31 on: April 01, 2012, 01:05:35 PM »
I worked too on the glorious Z80 CPU. Many cash counters used Z80 or 8085. I wrote a multitasking OS on industrial boards that used that uP (taking ideas from DIGITAL RSX executive). At that time that CPU could do many things  (minicomputer had a clock at 15-20MHz, today have 2GHz) ::) Then I moved to 68k and x86  :'(
The worst is that as soon as new faster CPU's come out the programmers have already produced bloated softwares that eat all the computational power....   :-\ with unusefull gadgets  >:(
You are right that there are many bugs on optimization, but our job is to find and signal them so Pelle can fix the compiler. It's our payment for use of the compiler itself.
Anyway with no optimization you'll spare some problems and with actual CPU clock's it's hard to see any difference. Unless when strong compute power is used like in math routines (matricial calculations, discrete integration, real-time FFT and DCS for video, etc), but also intensive string manipulation, substitution & replacement can show the difference.
« Last Edit: April 01, 2012, 01:08:45 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

CommonTater

  • Guest
Re: Variable changes in between functions (out of bounds?)
« Reply #32 on: April 01, 2012, 05:16:03 PM »
The worst is that as soon as new faster CPU's come out the programmers have already produced bloated softwares that eat all the computational power....   :-\ with unusefull gadgets  >:(

Don't even get me started on this one! :D  I've long held that Microsoft would make more money selling a minimalist, rock solid, OS... and nothing but the OS... Add your own options --browser, word pro, etc.-- by download, don't ship it with the OS.    But then I see people go all gaga over an onscreen CPU monitor (why?) or a fancy clock that manages to consume 10% CPU...  It's really amazing the crap people do to perfectly good computers...
 
And FWIW... yes, I agree, there is a LOT of really crappy software out there.

Quote
You are right that there are many bugs on optimization, but our job is to find and signal them so Pelle can fix the compiler. It's our payment for use of the compiler itself.

Well, that and an annual donation...

Quote
Anyway with no optimization you'll spare some problems and with actual CPU clock's it's hard to see any difference. Unless when strong compute power is used like in math routines (matricial calculations, discrete integration, real-time FFT and DCS for video, etc), but also intensive string manipulation, substitution & replacement can show the difference.
Surprisingly, I do very little math in the things I do.  Most of it is file access --Inventory records, file copies, etc.  The busiest parts of it are generally broken up by the relatively slow disk access. The slowest parts of my applications are the keyboard, most spend 80% of their time waiting for someone to type something.  As such it's likely the optimizations don't make much overall difference.  On AMD CPUs with "cool and quiet" enabled, it's unusual for them to ever get up to full speed, mostly they just idle along at 1/2 speed.  It's not like I'm sending it off to do 6 hour long calculation runs or something...