Author Topic: DARPA suggests turning old C code automatically into Rust  (Read 26559 times)

0 Members and 2 Guests are viewing this topic.

Offline SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 17801
  • Country: fr
 

Offline xrunner

  • Super Contributor
  • ***
  • Posts: 7969
  • Country: us
  • hp>Agilent>Keysight>???
Re: DARPA suggests turning old C code automatically into Rust
« Reply #1 on: August 06, 2024, 02:36:50 am »
TRACTOR: TRanslating All C TO Rust

I knew it involved AI as soon as I saw your post.  :-+
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline mfro

  • Regular Contributor
  • *
  • Posts: 226
  • Country: de
Re: DARPA suggests turning old C code automatically into Rust
« Reply #2 on: August 06, 2024, 05:25:31 am »
Quote
"You can go to any of the LLM websites, start chatting with one of the AI chatbots, and all you need to say is 'here's some C code, please translate it to safe idiomatic Rust code,' cut, paste, and something comes out, and it's often very good, but not always,"

Uhh. Not sure if I'd trust the result more than man-made C code...
Beethoven wrote his first symphony in C.
 
The following users thanked this post: bck, radiolistener

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 17251
  • Country: de
Re: DARPA suggests turning old C code automatically into Rust
« Reply #3 on: August 06, 2024, 08:14:03 am »
The idea is getting away from C with it's often unsafe use of pointers and memory handling. A translation of code that uses such features would be tricky.

Translating C code automaticly likely makes the code unreadable for humans, even more than the original C. It would than be essentially impossible to find and fix other errors.
A manual translation to a new language may actually be a good idea. Sometime a new start / rewirte can make the code clearer and even detect old errors.
 
The following users thanked this post: systemCorrµPti0n

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: DARPA suggests turning old C code automatically into Rust
« Reply #4 on: August 06, 2024, 08:31:55 am »
This sounds like one of those concepts which can make simple things easy and difficult things impossible.

Determining the intention of a lump of code is non-trivial.

Spotting examples of the standard C/C++ problems that cause security and other failures is non-trivial.

If those things were easy, they would be in compilers (+ lint, naturally  >:D ).

Waving magic pixie dust (i.e. AI) around won't solve anything interesting.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: janoc, Howardlong, Karel, unseenninja

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5098
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #5 on: August 06, 2024, 08:37:12 am »
Good use of Tractor: use it to learn Rust
Write C code and learn how it should be in Rust

HappyDays :)
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30244
  • Country: nl
    • NCT Developments
Re: DARPA suggests turning old C code automatically into Rust
« Reply #6 on: August 06, 2024, 08:37:31 am »
Wouldn't it be more usefull to analyse the code for potential buffer overflows and mitigate those?
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 6904
  • Country: li
Re: DARPA suggests turning old C code automatically into Rust
« Reply #7 on: August 06, 2024, 08:46:21 am »
It seems the gov sector is the easiest to BS audience for the "bleeding edge technology fund risers"..


Readers discretion is advised..
 
The following users thanked this post: magic

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: DARPA suggests turning old C code automatically into Rust
« Reply #8 on: August 06, 2024, 10:00:26 am »
Good use of Tractor: use it to learn Rust
Write C code and learn how it should be in Rust

HappyDays :)

As the old joke goes, "If I wanted to go there, I wouldn't start from here".

Happy Daze :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 11253
  • Country: fi
Re: DARPA suggests turning old C code automatically into Rust
« Reply #9 on: August 06, 2024, 10:46:03 am »
Wouldn't it be more usefull to analyse the code for potential buffer overflows and mitigate those?

Two problems:
1) this is an already solved problem, with all those actually important codebases already analysed,
2) this doesn't sound investor-sexy in any way, look how boring you made it sound like.

Therefore, for taxpayer and/or investor money, it needs to be graphene hydrogen cloud egge computing AI. And of course, the trend language of the year.
 
The following users thanked this post: janoc, Howardlong, DimitriP, eutectique

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30244
  • Country: nl
    • NCT Developments
Re: DARPA suggests turning old C code automatically into Rust
« Reply #10 on: August 06, 2024, 09:37:50 pm »
OK, sorry. I'll go back to my day job at the sales prevention department.  8)
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: DARPA suggests turning old C code automatically into Rust
« Reply #11 on: August 06, 2024, 10:43:04 pm »
OK, sorry. I'll go back to my day job at the sales prevention department.  8)

Mine was at the "going down blind alley" prevention department - semi-seriously, of course.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #12 on: August 06, 2024, 11:13:31 pm »
Old C code naturally rusts. No action is needed. Try to build many old packages, and you are in for some serious welding of patches over the rust.
 
The following users thanked this post: artag

Offline mfro

  • Regular Contributor
  • *
  • Posts: 226
  • Country: de
Re: DARPA suggests turning old C code automatically into Rust
« Reply #13 on: August 12, 2024, 07:15:38 am »
The only real advantage of AI I've seen so far is that it appears BS blockchain talking :blah: decreased a lot.
Beethoven wrote his first symphony in C.
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1553
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #14 on: August 12, 2024, 04:43:11 pm »
How could this possibly be useful ?

If it's good, error-less C code, it won't make any difference. It's not that compilers compile unsafely.

If it's unsafe C code and the translator creates safe Rust, it has to do something different. So it's not functionally equivalent. The C code might DEPEND on being unsafe to work. How do you know the translation is correct ?

At best you end up with something that can be tested (probably requiring fixes) and maintained as Rust. And might be unreadable.

Maybe DARPA's next idea will be arming soldiers with dummy rifles so there won't be any friendly fire incidents.

« Last Edit: August 12, 2024, 04:48:32 pm by artag »
 
The following users thanked this post: mfro

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 5743
  • Country: Earth
Re: DARPA suggests turning old C code automatically into Rust
« Reply #15 on: August 16, 2024, 06:29:19 am »
Quote
"You can go to any of the LLM websites, start chatting with one of the AI chatbots, and all you need to say is 'here's some C code, please translate it to safe idiomatic Rust code,' cut, paste, and something comes out, and it's often very good, but not always,"

Uhh. Not sure if I'd trust the result more than man-made C code...

I have the same thoughts  :)

I wouldn't trust to such AI translated code at all, just because I'm often using AI to generate functions. The result, even if it works is usually unusable due to a lot of mistakes which is almost impossible to detect with testing. So it requires to analyze and rework code generated by AI manually. In some cases it may be minor changes, but sometimes AI just unable to generate good code for some tasks and it requires to rewrite it manually from scratch.

In my opinion just 1-10% of AI generated code is usable the rest needs to be refactored or rewritten from scratch.
« Last Edit: August 16, 2024, 06:34:50 am by radiolistener »
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6039
  • Country: gb
  • Doing electronics since the 1960s...
Re: DARPA suggests turning old C code automatically into Rust
« Reply #16 on: October 10, 2024, 08:27:42 pm »
"AI" doesn't actually exist.

Look up how ChatGPT really works. But 99.9% of people think it is "AI".

There has been minimal progress in generic AI since the 1970s. Lots of vertical applications, sure. Especially in applications involving pattern recognition.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 
The following users thanked this post: dustooff

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #17 on: October 10, 2024, 10:20:06 pm »
"AI" doesn't actually exist.

Look up how ChatGPT really works. But 99.9% of people think it is "AI".

There has been minimal progress in generic AI since the 1970s. Lots of vertical applications, sure. Especially in applications involving pattern recognition.
Well, what they have are elaborate pattern matchers, like a comms equalizer on steroids, and using a similar underlying principle - the correlation quality of a convolution. That is a key part of natural intelligence. Its just not the whole thing. I wonder why the physics Nobel prize didn't go to Norbert Weiner. ;)
 

Offline SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 17801
  • Country: fr
Re: DARPA suggests turning old C code automatically into Rust
« Reply #18 on: October 11, 2024, 08:58:54 am »
Interestingly, I think the concept that is shown in the following site (that I linked to in another thread) also applies here with LLMs : https://tylervigen.com/spurious-correlations

What LLMs do (and CNNs in general) is pretty much that: a bunch of correlations on large sets of data, with the goal that it would yield something "intelligent". Makes you ponder.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #19 on: October 11, 2024, 12:40:51 pm »
Interestingly, I think the concept that is shown in the following site (that I linked to in another thread) also applies here with LLMs : https://tylervigen.com/spurious-correlations

What LLMs do (and CNNs in general) is pretty much that: a bunch of correlations on large sets of data, with the goal that it would yield something "intelligent". Makes you ponder.
We all realise that people need constant reminders that correlation does not mean causation, because the human mind is wired as a pattern matcher, and keeps hooking onto many false correlations. The snag in 2024 is that line has been repeated so many times, dumb people are now claiming that when things correlate that means there is NO causation. The difference between IQ and wisdom/common sense/whatever you want to call it appears to be mostly that IQ is largely pattern matching, and wisdom is the ability to filter out the dumb matches.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: DARPA suggests turning old C code automatically into Rust
« Reply #20 on: October 11, 2024, 01:44:59 pm »
Interestingly, I think the concept that is shown in the following site (that I linked to in another thread) also applies here with LLMs : https://tylervigen.com/spurious-correlations

What LLMs do (and CNNs in general) is pretty much that: a bunch of correlations on large sets of data, with the goal that it would yield something "intelligent". Makes you ponder.
We all realise that people need constant reminders that correlation does not mean causation, because the human mind is wired as a pattern matcher, and keeps hooking onto many false correlations. The snag in 2024 is that line has been repeated so many times, dumb people are now claiming that when things correlate that means there is NO causation. The difference between IQ and wisdom/common sense/whatever you want to call it appears to be mostly that IQ is largely pattern matching, and wisdom is the ability to filter out the dumb matches.

I don't think anybody claimed Igor Aleksander's 1983 WISARD had IQ :)

It was designed, like modern ML systems, to do pattern matching based on training sets. It worked well in the lab when trained on pictures of tanks and cars, but failed miserably on Luneberger Heath. Nobody could tell why. Eventually they figured out the training set was car adverts and tanks in N Europe, and it was discriminating between sunny days and cloudy days. It is rumoured that Aleksander's colleagues wouldn't recognise his existence on sunny days.

Modern ML systems are more sophisticated. They recommend for/against medical treatment based on the font labelling the scan.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #21 on: October 11, 2024, 02:15:10 pm »
I don't think anybody claimed Igor Aleksander's 1983 WISARD had IQ :)

It was designed, like modern ML systems, to do pattern matching based on training sets. It worked well in the lab when trained on pictures of tanks and cars, but failed miserably on Luneberger Heath. Nobody could tell why. Eventually they figured out the training set was car adverts and tanks in N Europe, and it was discriminating between sunny days and cloudy days. It is rumoured that Aleksander's colleagues wouldn't recognise his existence on sunny days.

Modern ML systems are more sophisticated. They recommend for/against medical treatment based on the font labelling the scan.
You keep quoting that ham fisted botched up case like it represents something significant. It just represents what incompetence can achieve on a good day.
 
The following users thanked this post: thm_w

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: DARPA suggests turning old C code automatically into Rust
« Reply #22 on: October 11, 2024, 02:20:09 pm »
I don't think anybody claimed Igor Aleksander's 1983 WISARD had IQ :)

It was designed, like modern ML systems, to do pattern matching based on training sets. It worked well in the lab when trained on pictures of tanks and cars, but failed miserably on Luneberger Heath. Nobody could tell why. Eventually they figured out the training set was car adverts and tanks in N Europe, and it was discriminating between sunny days and cloudy days. It is rumoured that Aleksander's colleagues wouldn't recognise his existence on sunny days.

Modern ML systems are more sophisticated. They recommend for/against medical treatment based on the font labelling the scan.
You keep quoting that ham fisted botched up case like it represents something significant. It just represents what incompetence can achieve on a good day.

It was an early harbinger of things to come.

The same fundamental problems exist in modern ML systems in spades, except now they can screw up many peoples' lives.

Key concepts:
  • you can't test quality into a system (test==training example), quality has to be designed
  • "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." Modern ML systems can only be the latter
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: DARPA suggests turning old C code automatically into Rust
« Reply #23 on: October 11, 2024, 02:26:49 pm »
I don't think anybody claimed Igor Aleksander's 1983 WISARD had IQ :)

It was designed, like modern ML systems, to do pattern matching based on training sets. It worked well in the lab when trained on pictures of tanks and cars, but failed miserably on Luneberger Heath. Nobody could tell why. Eventually they figured out the training set was car adverts and tanks in N Europe, and it was discriminating between sunny days and cloudy days. It is rumoured that Aleksander's colleagues wouldn't recognise his existence on sunny days.

Modern ML systems are more sophisticated. They recommend for/against medical treatment based on the font labelling the scan.
You keep quoting that ham fisted botched up case like it represents something significant. It just represents what incompetence can achieve on a good day.

It was an early harbinger of things to come.

The same fundamental problems exist in modern ML systems in spades, except now they can screw up many peoples' lives.

Key concepts:
  • you can't test quality into a system (test==training example), quality has to be designed
  • "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." Modern ML systems can only be the latter
Ah, the same old rubbish you say each time. An ML system doesn't have to be perfect, since we mostly use these systems to replace highly flawed humans. We only need reasonable confidence that they are no worse than a human. An ML system is quite like a human with no common sense. Well, large numbers of humans have no common sense either, which is probably why bad many ML system responses seem a lot like the dumber of the people around us. When you look at applications where things need to be perfect, like the AI chips floor planning tools that are becoming widely used, the tool doesn't have to be perfect. Like a human doing the floor planning, you expect a lot of errors, so you use rigorous tools to see that the final result gets properly cleaned up.
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6039
  • Country: gb
  • Doing electronics since the 1960s...
Re: DARPA suggests turning old C code automatically into Rust
« Reply #24 on: October 11, 2024, 04:49:09 pm »
I think the remaining tricky issue with ML is that you mostly don't know how the machine learnt it.

Hence the funny cases of recognising a husky (dog) with very high reliability, but actually only because all husky pics used to train the software contained a snow background.

I don't know that this has ever been solved - other than by selecting the learning material carefully but then you still don't actually know what the machine is looking at.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->