public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: niva@niisi.msk.ru
To: gcc-gnats@gcc.gnu.org
Subject: c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression
Date: Tue, 22 Apr 2003 10:46:00 -0000	[thread overview]
Message-ID: <20030422104041.9808.qmail@sources.redhat.com> (raw)


>Number:         10450
>Category:       c
>Synopsis:       gcc-3.2.2 produces error on initializing a structure with a constant expression
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 10:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Nadezhda I. Vyukova
>Release:        gcc-3.2.2
>Organization:
>Environment:
i386 (i686-pc-linux-gnu)
gcc configured with --enable-cpp --enable-languages=all
--enable-shared
>Description:
The following error message is produced when I compile
the source code (gcc -S foo.c):
foo.c:14: initializer element is not constant
foo.c:14: (near initialization for `registers_pid_1')
foo.c:14: initializer element is not constant

I think that this behaviour contradicts to C99, 6.7.8-13. And note that gcc-2.95.3 compiles this code successfully. 
>How-To-Repeat:
typedef struct t_inf_id {
  int board;
  int processor;
  int process;
  int thread;
} t_inf_id;

typedef struct inf_id {
  unsigned long machine;
  t_inf_id tid;
  int att_flag;
} inf_id;

inf_id registers_pid_1 = ((inf_id) {0, (t_inf_id) {0, 0, -1, -1}, 0}); /* Error!*/
inf_id registers_pid_2 = ((inf_id) {0, {0, 0, -1, -1}, 0}); /* OK! */
t_inf_id t_registers_pid = ((t_inf_id) {0, 0, -1, -1});     /* OK! */
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-04-22 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 10:46 niva [this message]
2003-04-22 13:36 Joseph S. Myers
2003-04-22 23:03 bangerth

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=20030422104041.9808.qmail@sources.redhat.com \
    --to=niva@niisi.msk.ru \
    --cc=gcc-gnats@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).