Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check return codes everywhere #5350

Closed
vicuna opened this Issue Aug 27, 2011 · 5 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Aug 27, 2011

Original bug ID: 5350
Reporter: @elfring
Status: closed (set by @xavierleroy on 2015-12-11T18:21:22Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Some checks for return codes are missing.

Examples:
Would you like to add more error handling for return values from "lseek" like in the function "read_trailer" and from "fprintf" in the function "caml_trace_value_file"?

Additional information

http://caml.inria.fr/cgi-bin/viewcvs.cgi/ocaml/trunk/byterun/startup.c?rev=11156&view=auto
http://caml.inria.fr/cgi-bin/viewcvs.cgi/ocaml/trunk/byterun/instrtrace.c?rev=11156&view=auto

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Aug 27, 2011

Comment author: @elfring

I suggest to avoid unchecked function calls.
Would you like to detect every error situation as early as possible?

Another update candidate:
function "editbuffer_getasline" ? realloc()
http://caml.inria.fr/cgi-bin/viewcvs.cgi/ocaml/trunk/win32caml/editbuffer.c?rev=11156&view=auto

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Mar 26, 2012

Comment author: @lefessan

"lseek" would indeed need a fix, but the other functions are mostly debug functions, where error handling is not important.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Mar 26, 2012

Comment author: @elfring

How do you think about a topic like "How to raise warning if return value is
disregarded - gcc or static code check?"?
http://stackoverflow.com/questions/2042780/how-to-raise-warning-if-return-value-is-disregarded-gcc-or-static-code-check

How do you think about to apply aspect-oriented software development?
http://coccinelle.lip6.fr/
http://research.msrg.utoronto.ca/ACC/Tutorial#A_Reusable_Aspect_for_Memory_All
http://aspectc.org/

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jul 30, 2013

Comment author: dsheets

The return code lseek in read_trailer will never matter as the immediately subsequent read call will always fail if the lseek fails. This will result in a BAD_BYTECODE error.

Is there an actual error in the compiler that results from an unchecked return code that has turned up?

Without a bug reproduction or a listing of questionable code locations, I think this bug should be closed.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Aug 1, 2013

Comment author: @xavierleroy

Added check for lseek() in read_trailer(). (Commits r13959 in version/4.01 and r13960 in trunk.) I agree with dsheets that it's not really necessary, but the code is clearer this way. Debug printf's don't need checks.

@vicuna vicuna closed this Dec 11, 2015

@vicuna vicuna added this to the 4.01.0 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.