public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64856] New: Initializing struct not accepted in gnu99
Date: Thu, 29 Jan 2015 11:48:00 -0000	[thread overview]
Message-ID: <bug-64856-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856

            Bug ID: 64856
           Summary: Initializing struct not accepted in gnu99
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org

struct A {
  unsigned long b;
};

struct B {
  struct A c[2];
};

struct B d = { .c = { [0 ... 1] = (struct A){ .b = -1UL } } };

$ ./cc1 -quiet j.c -std=gnu90
$ ./cc1 -quiet j.c -std=gnu99
j.c:9:35: error: initializer element is not constant
 struct B d = { .c = { [0 ... 1] = (struct A){ .b = -1UL } } };
                                   ^
j.c:9:35: note: (near initialization for ‘d.c[0]’)
j.c:9:35: error: initializer element is not constant
j.c:9:35: note: (near initialization for ‘d.c[1]’)

This is bad with gnu11 as a default.
>From gcc-bugs-return-475384-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 29 11:48:07 2015
Return-Path: <gcc-bugs-return-475384-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7198 invoked by alias); 29 Jan 2015 11:48:06 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7017 invoked by uid 48); 29 Jan 2015 11:47:58 -0000
From: "bugs at stellardeath dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64854] No bound check for explicit-shape arrays
Date: Thu, 29 Jan 2015 11:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bugs at stellardeath dot org
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64854-4-U1W8I24Qd6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64854-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64854-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg03378.txt.bz2
Content-length: 547

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64854

--- Comment #2 from Lorenz Hüdepohl <bugs at stellardeath dot org> ---
(Please remove the line "use m1" from my example, its a leftover from a
previous
 version)

I'm not denying that there is a mistake in the example program. I just hoped
that -fcheck=bounds would save me from this kind of mistake.

Please consider this not a bug report then, but a feature request :)

It really would help tremendously if this kind of misbehaviour could be checked
at run-time via -fcheck-bounds.
>From gcc-bugs-return-475387-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 29 12:00:43 2015
Return-Path: <gcc-bugs-return-475387-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2770 invoked by alias); 29 Jan 2015 12:00:42 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2480 invoked by uid 48); 29 Jan 2015 12:00:33 -0000
From: "alserkli at inbox dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/64803] [5 Regression] __LINE__ inside macro is not constant
Date: Thu, 29 Jan 2015 12:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: alserkli at inbox dot ru
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64803-4-Hvqzovq4QV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64803-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64803-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg03381.txt.bz2
Content-length: 156

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd803

--- Comment #4 from Alexander Klimov <alserkli at inbox dot ru> ---
Thanks! Your patch works for llvm.


             reply	other threads:[~2015-01-29 11:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 11:48 mpolacek at gcc dot gnu.org [this message]
2015-01-29 11:48 ` [Bug c/64856] " mpolacek at gcc dot gnu.org
2015-02-09 21:19 ` mpolacek at gcc dot gnu.org
2015-02-09 21:20 ` mpolacek at gcc dot gnu.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-64856-4@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: 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).