public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/19449] __builtin_constant_p cannot resolve to const when optimizing Date: Thu, 28 Mar 2013 08:54:00 -0000 [thread overview] Message-ID: <bug-19449-4-DqJeRUQevf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-19449-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19449 --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-28 08:53:54 UTC --- Created attachment 29742 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29742 gcc49-pr19449.patch Untested patch. There is another case where we'd better fold __builtin_constant_p right away, for static/extern function-local array dimensions: int y; static char a[__builtin_constant_p (y) ? -1 : 1]; extern char b[__builtin_constant_p (y) ? -1 : 1]; char d[__builtin_constant_p (y) ? -1 : 1]; void foo (int x) { static char e[__builtin_constant_p (x) ? -1 : 1]; extern char f[__builtin_constant_p (x) ? -1 : 1]; auto char g[__builtin_constant_p (x) ? -1 : 1]; char h[__builtin_constant_p (x) ? -1 : 1]; } Right now this compiles fine for -O0, but for -O1 and above it errors on e and f (twice on the latter actually). When cfun == NULL, we always fold __builtin_constant_p right away, but when cfun is NULL, we don't consider static/extern. Not sure how to fix this issue though, because I think the declspecs aren't passed down to declarator parsing.
next prev parent reply other threads:[~2013-03-28 8:54 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-19449-4@http.gcc.gnu.org/bugzilla/> 2010-11-29 20:07 ` pinskia at gcc dot gnu.org 2013-03-28 6:58 ` mpolacek at gcc dot gnu.org 2013-03-28 8:54 ` jakub at gcc dot gnu.org [this message] 2013-04-03 10:00 ` jakub at gcc dot gnu.org 2013-11-27 20:57 ` desrt at desrt dot ca 2021-02-10 23:39 ` msebor at gcc dot gnu.org 2005-01-14 19:11 [Bug c/19449] New: " eplondke at gmail dot com 2005-01-14 19:14 ` [Bug c/19449] " ian at airs dot com 2005-01-14 19:22 ` eplondke at gmail dot com 2005-01-14 19:26 ` pinskia at gcc dot gnu dot 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-19449-4-DqJeRUQevf@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: linkBe 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).