From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15781 invoked by alias); 1 Dec 2008 21:05:49 -0000 Received: (qmail 15526 invoked by uid 48); 1 Dec 2008 21:04:27 -0000 Date: Mon, 01 Dec 2008 21:05:00 -0000 Subject: [Bug c/38354] New: Spurious error: initializer element is not computable at load time X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gnu at behdad dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-12/txt/msg00095.txt.bz2 The following code is from gcc docs and works as expected: #include 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