Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust

Kaz Kylheku <643-408-1753@kylheku.com>
Wed, 14 May 2025 20:01:47 -0000

          From comp.compilers

Related articles
Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust johnl@taugh.com (John R Levine) (2025-05-09)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust derek-nospam@shape-of-code.com (Derek) (2025-05-13)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust arnold@freefriends.org (2025-05-14)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust 643-408-1753@kylheku.com (Kaz Kylheku) (2025-05-14)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust anton@mips.complang.tuwien.ac.at (2025-05-15)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust gneuner2@comcast.net (George Neuner) (2025-05-15)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust christopher.f.clark@compiler-resources.com (Christopher F Clark) (2025-05-16)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust cross@spitfire.i.gajendra.net (2025-05-16)
Re: Paper: PR2: Peephole Raw Pointer Rewriting with LLMs for Translating C to Safer Rust 643-408-1753@kylheku.com (Kaz Kylheku) (2025-05-16)
| List of all articles for this month |
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.compilers
Date: Wed, 14 May 2025 20:01:47 -0000
Organization: Compilers Central
References: 25-05-004 25-05-005 25-05-006
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="32612"; mail-complaints-to="abuse@iecc.com"
Keywords: Rust, optimize
Posted-Date: 14 May 2025 16:42:18 EDT

On 2025-05-14, arnold@freefriends.org <arnold@freefriends.org> wrote:
> In article 25-05-005,
> Derek <derek-nospam@shape-of-code.com> wrote:
>>I suspect that the same is happening with Rust. If so, how does using
>>Rust make the code safer than using C without any checking switched
>>on?
>
> Rust catches many problems at compile time. I am not at all a Rust
> expert, or even a novice, but I don't think Rust does runtime
> bounds checking, since it relies on compiler analysis instead.


How would it be safe if you could write a Rust program that asks the
user to input a random decimal number, and then uses it an index to
access an array, without any check?


The compiler will eliminate bounds checks at compile time if it can
infer they are unnecessary; e.g. a loop sets up a dummy variable to step
over the correct range, and does not mess with it otherwise.


--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.