aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/implement-c.texi
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2006-11-16 21:25:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2006-11-16 21:25:16 +0000
commita9e64c639ef604bfc2d734b3973dfc0953875877 (patch)
tree3474f1e6d8e5a0484dd9285fb4f30365e230b1df /gcc/doc/implement-c.texi
parentc8cf9f0f27b4bc784419f60976390c6e4111ccae (diff)
downloadgcc-a9e64c639ef604bfc2d734b3973dfc0953875877.zip
gcc-a9e64c639ef604bfc2d734b3973dfc0953875877.tar.gz
gcc-a9e64c639ef604bfc2d734b3973dfc0953875877.tar.bz2
re PR middle-end/26306 (ICE on volatile array with non-constant bounds)
PR middle-end/26306 * gimplify.c (gimplify_expr): Only force a load for references to non-BLKmode volatile values. * doc/implement-c.texi (Qualifiers implementation): Document the interpretation of what a volatile access is. * doc/extend.texi (C++ Extensions): Rework same documentation. From-SVN: r118900
Diffstat (limited to 'gcc/doc/implement-c.texi')
-rw-r--r--gcc/doc/implement-c.texi37
1 files changed, 36 insertions, 1 deletions
diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi
index 9631233..dc99610 100644
--- a/gcc/doc/implement-c.texi
+++ b/gcc/doc/implement-c.texi
@@ -503,7 +503,42 @@ determined by the ABI@.
@cite{What constitutes an access to an object that has volatile-qualified
type (C90 6.5.3, C99 6.7.3).}
-@xref{Volatiles, , When is a Volatile Object Accessed?}.
+Such an object is normally accessed by pointers and used for accessing
+hardware. In most expressions, it is intuitively obvious what is a read
+and what is a write. For example
+
+@smallexample
+volatile int *dst = @var{somevalue};
+volatile int *src = @var{someothervalue};
+*dst = *src;
+@end smallexample
+
+@noindent
+will cause a read of the volatile object pointed to by @var{src} and store the
+value into the volatile object pointed to by @var{dst}. There is no
+guarantee that these reads and writes are atomic, especially for objects
+larger than @code{int}.
+
+However, if the volatile storage is not being modified, and the value of
+the volatile storage is not used, then the situation is less obvious.
+For example
+
+@smallexample
+volatile int *src = @var{somevalue};
+*src;
+@end smallexample
+
+According to the C standard, such an expression is an rvalue whose type
+is the unqualified version of its original type, i.e. @code{int}. Whether
+GCC interprets this as a read of the volatile object being pointed to or
+only as a request to evaluate the expression for its side-effects depends
+on this type.
+
+If it is a scalar type, or on most targets an aggregate type whose only
+member object is of a scalar type, or a union type whose member objects
+are of scalar types, the expression is interpreted by GCC as a read of
+the volatile object; in the other cases, the expression is only evaluated
+for its side-effects.
@end itemize