|
|
Subscribe / Log in / New account

Repercussions for potential future C flags?

Repercussions for potential future C flags?

Posted Apr 26, 2023 12:56 UTC (Wed) by ballombe (subscriber, #9523)
In reply to: Repercussions for potential future C flags? by swilmet
Parent article: An update on the GCC frontend for Rust

Consider a<<=b. if the compiler output the local asm equivalent of 'shl a,b',
if b >= sizeof(a)*8, the result will depends on the CPU.
So if you want to remove the 'hardware defined behaviour', you will have to make this operation
several time slower than needed on some CPU.
So your transpiler might generate code that is much slower than the original C code.


to post comments

Repercussions for potential future C flags?

Posted Apr 26, 2023 13:44 UTC (Wed) by swilmet (subscriber, #98424) [Link]

> So your transpiler might generate code that is much slower than the original C code.

If what the transpiler takes as input is a proper subset of C, then a full C compiler can be used too, and the transpiler to Rust would serve as additional sanity checks (like other static analysis tools: Coverity Scan, etc).


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds