Skip to content

Commit 2be801a

Browse files
author
Andrew Pinski
committed
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>
1 parent 0e09be9 commit 2be801a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gcc/doc/extend.texi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17252,7 +17252,8 @@ is computed.
1725217252

1725317253
@smallexample
1725417254
struct V @{ char buf1[10]; int b; char buf2[10]; @} var;
17255-
char *p = &var.buf1[1], *q = &var.b;
17255+
char *p = &var.buf1[1];
17256+
int *q = &var.b;
1725617257

1725717258
/* Here the object p points to is var. */
1725817259
assert (__builtin_object_size (p, 0) == sizeof (var) - 1);

0 commit comments

Comments
 (0)