Frama-C-discuss mailing list archives
This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Frama-c-discuss] fopen and null pointers
- Subject: [Frama-c-discuss] fopen and null pointers
- From: dmentre at linux-france.org (David MENTRE)
- Date: Tue, 18 Aug 2015 10:22:09 +0200
- In-reply-to: <CAGSRWbj5P39h_RvyD_c44VUJX4oOgT21+N37Y72o+tT_q6R6LA@mail.gmail.com>
- References: <CAGSRWbj5P39h_RvyD_c44VUJX4oOgT21+N37Y72o+tT_q6R6LA@mail.gmail.com>
Hello, Le 18/08/2015 06:11, Tim Newsham a écrit : > fp = fopen("./seq","r"); > /*@ assert Value: ptr_comparison: \pointer_comparable(fp, (void *)0); */ > > Is there a way I can annotate this call or the fopen function > to specify that NULL is a valid return value? Use the standard headers (see attached example). But in your example (at least in mine), the warning is coming from garbled mix in "fp" (comparison with a variable containing garbled mix). I don't know *why* this garbled mix occurs though. frama-c -val tim-fopen.c [...] [value] Values at end of function main: fp â {{ garbled mix of &{__fc_fopen; alloced_return_fopen} (origin: Arithmetic {tim-fopen.c:8}) }} Best regards, david -------------- next part -------------- #include <stdio.h> #include <stdlib.h> int main(void) { FILE *fp; fp = fopen("./seq","r"); if (fp == NULL) { return 0; } else { return 1; } }
- Follow-Ups:
- [Frama-c-discuss] fopen and null pointers
- From: boris at yakobowski.org (Boris Yakobowski)
- [Frama-c-discuss] fopen and null pointers
- References:
- [Frama-c-discuss] fopen and null pointers
- From: tim.newsham at gmail.com (Tim Newsham)
- [Frama-c-discuss] fopen and null pointers
- Prev by Date: [Frama-c-discuss] specification question
- Next by Date: [Frama-c-discuss] memcpy / memset question
- Previous by thread: [Frama-c-discuss] fopen and null pointers
- Next by thread: [Frama-c-discuss] fopen and null pointers
- Index(es):