public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64856] Initializing struct not accepted in gnu99
  2015-01-29 11:48 [Bug c/64856] New: Initializing struct not accepted in gnu99 mpolacek at gcc dot gnu.org
@ 2015-01-29 11:48 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-29 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-01-29
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |5.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine.


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

* [Bug c/64856] New: Initializing struct not accepted in gnu99
@ 2015-01-29 11:48 mpolacek at gcc dot gnu.org
  2015-01-29 11:48 ` [Bug c/64856] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-29 11:48 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug c/64856] Initializing struct not accepted in gnu99
  2015-01-29 11:48 [Bug c/64856] New: Initializing struct not accepted in gnu99 mpolacek at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-09 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Mon Feb  9 21:19:02 2015
New Revision: 220550

URL: https://gcc.gnu.org/viewcvs?rev=220550&root=gcc&view=rev
Log:
    PR c/64856
    * c-typeck.c (process_init_element): Don't always wrap
    COMPOUND_LITERAL_EXPR in a SAVE_EXPR in C99 mode when
    initializing a range of elements.

    * gcc.dg/pr64856.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr64856.c
Modified:
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/64856] Initializing struct not accepted in gnu99
  2015-01-29 11:48 [Bug c/64856] New: Initializing struct not accepted in gnu99 mpolacek at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-09 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-02-09 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 11:48 [Bug c/64856] New: Initializing struct not accepted in gnu99 mpolacek at gcc dot gnu.org
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

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