public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105401] Improved diagnostics for code from "Labels as Values" documentation
Date: Wed, 27 Apr 2022 11:58:43 +0000	[thread overview]
Message-ID: <bug-105401-4-zR8ewdzzWW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105401-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105401

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Actually never mind about point 3: I do actually get warnings from -Winline
when I turn on optimizations:

$ /usr/local/bin/gcc -c -Wall -Wextra -Wc++-compat -Winline -O2
labels_as_values.c
labels_as_values.c: In function 'asdf':
labels_as_values.c:3:19: warning: function 'asdf' can never be copied because
it saves address of local label in a static variable [-Winline]
    3 | static inline int asdf(void)
      |                   ^~~~
labels_as_values.c: In function 'zxcv':
labels_as_values.c:18:19: warning: function 'zxcv' can never be copied because
it saves address of local label in a static variable [-Winline]
   18 | static inline int zxcv(int i)
      |                   ^~~~
labels_as_values.c: In function 'qwerty':
labels_as_values.c:3:19: warning: inlining failed in call to 'asdf': function
not inlinable [-Winline]
    3 | static inline int asdf(void)
      |                   ^~~~
labels_as_values.c:36:30: note: called from here
   36 |     return (zxcv(array[i]) + asdf());
      |                              ^~~~~~
labels_as_values.c:18:19: warning: inlining failed in call to 'zxcv': function
not inlinable [-Winline]
   18 | static inline int zxcv(int i)
      |                   ^~~~
labels_as_values.c:36:13: note: called from here
   36 |     return (zxcv(array[i]) + asdf());
      |             ^~~~~~~~~~~~~~
$

Points 1 and 2 still stand, though.

  reply	other threads:[~2022-04-27 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  2:03 [Bug c/105401] New: " egallager at gcc dot gnu.org
2022-04-27 11:58 ` egallager at gcc dot gnu.org [this message]
2024-01-03  4:24 ` [Bug c/105401] " egallager at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105401-4-zR8ewdzzWW@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).