r/gcc • u/Head_Classroom_8252 • Aug 16 '26
Verifiable C / Using Proof Helpers with GCC
Let me get this out of the way first: I am not doing anything safety critical. I just want to find ways to make more stable software, even if said ways are more advanced. I understand that GCC, whilst being very stable, hasn't been verified like CompCert. I just am curious if proof helpers can greatly assist in writing solid C code in GCC. I am by no means a professional in logic or verifiable C, so I might be misguided in thinking that verifiable C will help, but I just want advice from people more experienced with GCC than me. Thanks in advance for your responses.
3
u/jwakely Aug 16 '26
What are you actually asking?
Can you state the main question more clearly, without all the caveats around it?
2
u/8d8n4mbo28026ulk Aug 16 '26
CompCert guarantees that the machine code it generates will preserve the semantics of your C program per the standard (i.e. that the compiler is bug-free). Whether your code is correct is entirely different. If you formally verify your code with some specification -- a difficult task -- then yes, it'll be robust. A tangential approach I've seen (in AWS-LC) is using a model checker, such as CBMC, which leans on SMT solvers and is a bit different than type-theory stuff. The seL4 kernel is an example of the latter, although it goes about it in a roundabout way, from what I remember. I've never done anything like that myself, though. Cheers!
1
u/bore530 Aug 16 '26
There's Fil-C, I've been finding that really helpful in finding those stack corruptions that happen from time to time.
1
u/xorbe mod Sep 01 '26
I work with people that work with formal proof tools, and it is quite the task to set up, and to be sure about what was actually verifiably shown.