public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gnu at behdad dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/38354] New: Spurious error: initializer element is not computable at load time Date: Mon, 01 Dec 2008 21:05:00 -0000 [thread overview] Message-ID: <bug-38354-8802@http.gcc.gnu.org/bugzilla/> (raw) The following code is from gcc docs and works as expected: #include <stdio.h> int main (int argc, char **argv) { static const int array[] = { &&foo-&&foo, &&bar-&&foo, &&hack-&&foo }; int i = argc - 1; goto *(array[i]+&&foo); foo: printf ("foo\n"); return 0; bar: printf ("bar\n"); return 0; hack: printf ("hack\n"); return 0; } However, if I change the array type from: static const int array[] = { &&foo-&&foo, &&bar-&&foo, &&hack-&&foo }; to: static const void *array[] = { &&foo-&&foo, &&bar-&&foo, &&hack-&&foo }; I get the error: label-value.c:6: error: initializer element is not computable at load time This doesn't make any sense to me. -- Summary: Spurious error: initializer element is not computable at load time Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gnu at behdad dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38354
next reply other threads:[~2008-12-01 21:05 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-12-01 21:05 gnu at behdad dot org [this message] 2008-12-01 23:35 ` [Bug c/38354] " jakub at gcc dot gnu dot org 2008-12-01 23:39 ` gnu at behdad dot org 2010-08-17 6:28 ` adam at consulting dot net dot nz
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-38354-8802@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).