diff options
| author | Andrew Pinski <andrew.pinski@oss.qualcomm.com> | 2025-08-18 12:00:45 -0700 |
|---|---|---|
| committer | Andrew Pinski <andrew.pinski@oss.qualcomm.com> | 2025-11-17 14:22:25 -0800 |
| commit | 5f28f7cea440e578014e1a7afc7f92b36f55a871 (patch) | |
| tree | fb4f2e1b08d3d11e4031fe55d44c45618d6795e2 | |
| parent | e46321811a95faebb38a3996cec7317df3fa248a (diff) | |
docs: Fix __builtin_object_size example [PR121581]
This example used to work (with C) in GCC 14 before the
warning for different pointer types without a cast was changed
to an error.
The fix is to make the q variable `int*` rather than the current `char*`.
This also fixes the example for C++ too.
Pushed as obvious after doing a `make html`.
PR middle-end/121581
gcc/ChangeLog:
* doc/extend.texi (__builtin_object_size): Fix example.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(cherry picked from commit 2be801a805c6cca08aaa33fd387dcc7bd4fe8aac)
| -rw-r--r-- | gcc/doc/extend.texi | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index f45927a908a..570e89a04af 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -16971,7 +16971,8 @@ is computed. @smallexample struct V @{ char buf1[10]; int b; char buf2[10]; @} var; -char *p = &var.buf1[1], *q = &var.b; +char *p = &var.buf1[1]; +int *q = &var.b; /* Here the object p points to is var. */ assert (__builtin_object_size (p, 0) == sizeof (var) - 1); |
