News for hackers. Stuff that matters.
Re:Dependency on rust removes support for a number of platforms by CyberRabbi on Monday February 08, 2021 @09:28PM (#26073177)
Automatically generating “memory safe” C is no harder than automatically generating “memory safe” LLVM bitcode.
Re:Dependency on rust removes support for a number of platforms by brundolf on Monday February 08, 2021 @10:46PM (#26073557)
I think the issue is all of C's undefined behavior
Re:Dependency on rust removes support for a number of platforms by ghoward on Monday February 08, 2021 @11:53PM (#26074026)
For the most part, that can be worked around as well, with careful use of unsigned arithmetic. See https://git.yzena.com/Yzena/Yc/src/branch/master/include/yc/... for some examples. All arithmetic is unsigned, but I use it to simulate 2's complement signed.
Re:Dependency on rust removes support for a number of platforms by CyberRabbi on Tuesday February 09, 2021 @04:21AM (#26075446)
That is not difficult to avoid if you are generating short primitives. You can for the most part just convert the LLVM bitcode that the Rust compiler would output to the equivalent C snippet. Since each snippet is short, you can trivially check if it invokes undefined behavior. LLVM bitcode also can exhibit undefined behavior.
Re:Dependency on rust removes support for a number of platforms by moosingin3space on Tuesday February 09, 2021 @09:28PM (#26085136)
> You can for the most part just convert the LLVM bitcode that the Rust compiler would output to the equivalent C snippet.

Sounds like a good argument to resurrect the LLVM C backend. As it stands, the Rust core team has no desire to implement a C backend, as it would be a ton of work for not much gain.