Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
90fddb3d
Commit
90fddb3d
authored
4 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] Documents new options -warn-invalid-pointer and -warn-pointer-downcast.
In the user manual and in the man page.
parent
a8cc62dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/userman/user-analysis.tex
+27
-0
27 additions, 0 deletions
doc/userman/user-analysis.tex
doc/userman/user-changes.tex
+2
-0
2 additions, 0 deletions
doc/userman/user-changes.tex
man/frama-c.1.md
+7
-0
7 additions, 0 deletions
man/frama-c.1.md
with
36 additions
and
0 deletions
doc/userman/user-analysis.tex
+
27
−
0
View file @
90fddb3d
...
@@ -152,6 +152,23 @@ With \texttt{-safe-arrays}, the two accesses to \lstinline|v| are considered
...
@@ -152,6 +152,23 @@ With \texttt{-safe-arrays}, the two accesses to \lstinline|v| are considered
invalid. (Accessing
\lstinline
|v.b[-2]| or
\lstinline
|v.b[3]| remains incorrect,
invalid. (Accessing
\lstinline
|v.b[-2]| or
\lstinline
|v.b[3]| remains incorrect,
regardless of the value of the option.)
regardless of the value of the option.)
\item
\optiondef
{
-
}{
warn-invalid-pointer
}
may be used to check that the code
does not perform illegal pointer arithmetics, creating pointers that do not
point inside an object or one past an object.
This option is disabled by default, allowing the creation of such invalid
pointers without alarm — but the dereference of an invalid pointer
\emph
{
always
}
generate an alarm.
For instance, no error is detected by default in the following example, as
the dereference is correct. However, if option
\texttt
{
-warn-invalid-pointer
}
is enabled, an error is detected at line 4.
\begin{ccode}
int x;
int *p =
&
x;
p++; // valid
p++; // undefined behavior
*(p-2) = 1;
\end{ccode}
\item
\optiondef
{
-
}{
unspecified-access
}
may be used to check when the
\item
\optiondef
{
-
}{
unspecified-access
}
may be used to check when the
evaluation of an expression depends on the order in which its sub-expressions
evaluation of an expression depends on the order in which its sub-expressions
...
@@ -179,6 +196,16 @@ Here, the \texttt{x} might be incremented by \texttt{g} before or after the
...
@@ -179,6 +196,16 @@ Here, the \texttt{x} might be incremented by \texttt{g} before or after the
call to
\texttt
{
f
}
, but since the two write accesses occur in different
call to
\texttt
{
f
}
, but since the two write accesses occur in different
functions,
\texttt
{
-unspecified-access
}
does not detect that.
functions,
\texttt
{
-unspecified-access
}
does not detect that.
\item
\optiondef
{
-
}{
warn-pointer-downcast
}
may be used to check that the code
does not downcast a pointer to an integer type. This option is set by default.
In the following example, analyzers report by default an error on the third
line. Disabling the option removes this verification.
\begin{ccode}
int x;
uintptr
_
t addr =
&
x;
int a =
&
x;
\end{ccode}
\item
\optiondef
{
-
}{
warn-signed-downcast
}
may be used to check that the analyzed
\item
\optiondef
{
-
}{
warn-signed-downcast
}
may be used to check that the analyzed
code does not downcast an integer to a signed integer type. This option is
code does not downcast an integer to a signed integer type. This option is
\emph
{
not
}
set by default. Without it, the analyzers do not perform such a
\emph
{
not
}
set by default. Without it, the analyzers do not perform such a
...
...
This diff is collapsed.
Click to expand it.
doc/userman/user-changes.tex
+
2
−
0
View file @
90fddb3d
...
@@ -8,6 +8,8 @@ release. First we list changes of the last release.
...
@@ -8,6 +8,8 @@ release. First we list changes of the last release.
\begin{itemize}
\begin{itemize}
\item
\textbf
{
Preparing the Sources:
}
added option
\item
\textbf
{
Preparing the Sources:
}
added option
\texttt
{
-cpp-extra-args-per-file
}
.
\texttt
{
-cpp-extra-args-per-file
}
.
\item
\textbf
{
Customizing Analyzers:
}
added options
\texttt
{
-warn-invalid-pointer
}
and
\texttt
{
-warn-pointer-downcast
}
\end{itemize}
\end{itemize}
\section*
{
20.0 (Calcium)
}
\section*
{
20.0 (Calcium)
}
...
...
This diff is collapsed.
Click to expand it.
man/frama-c.1.md
+
7
−
0
View file @
90fddb3d
...
@@ -450,12 +450,19 @@ the case (this is the default).
...
@@ -450,12 +450,19 @@ the case (this is the default).
**Deprecated**
: use
**-kernel-warn-key parser:decimal-float=once**
**Deprecated**
: use
**-kernel-warn-key parser:decimal-float=once**
(and variants) instead.
(and variants) instead.
[-no]-warn-invalid-pointer
: generate alarms for invalid pointer arithmetic. Defaults to no.
[-no]-warn-left-shift-negative
[-no]-warn-left-shift-negative
: generate alarms for signed left shifts on negative values. Defaults to yes.
: generate alarms for signed left shifts on negative values. Defaults to yes.
[-no]-warn-right-shift-negative
[-no]-warn-right-shift-negative
: generate alarms for signed right shifts on negative values. Defaults to no.
: generate alarms for signed right shifts on negative values. Defaults to no.
[-no]-warn-pointer-downcast
: generates alarms when the downcast of a pointer may exceed the destination
range. Defaults to yes.
[-no]-warn-signed-downcast
[-no]-warn-signed-downcast
: generates alarms when signed downcasts may exceed the destination range.
: generates alarms when signed downcasts may exceed the destination range.
Defaults to no.
Defaults to no.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment