public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38354]  New: Spurious error: initializer element is not computable at load time
@ 2008-12-01 21:05 gnu at behdad dot org
  2008-12-01 23:35 ` [Bug c/38354] " jakub at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: gnu at behdad dot org @ 2008-12-01 21:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-09 15:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-38354-4@http.gcc.gnu.org/bugzilla/>
2014-09-05 10:21 ` [Bug c/38354] Spurious error: initializer element is not computable at load time adam at consulting dot net.nz
2014-09-05 11:38 ` redi at gcc dot gnu.org
2014-09-08  1:21 ` adam at consulting dot net.nz
2014-09-09  2:19 ` adam at consulting dot net.nz
2014-09-09 13:13 ` redi at gcc dot gnu.org
2014-09-09 15:59 ` joseph at codesourcery dot com
2008-12-01 21:05 [Bug c/38354] New: " gnu at behdad dot org
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

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).