]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
docs: Fix __builtin_object_size example [PR121581]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 18 Aug 2025 19:00:45 +0000 (12:00 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 18 Aug 2025 19:20:32 +0000 (12:20 -0700)
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>
gcc/doc/extend.texi

index cc9005439a492ff73d19801d76bfd1e23e9400e9..382295834035e48ea24b3ecbad8d61f9c37e4dc7 100644 (file)
@@ -17252,7 +17252,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);