public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array
@ 2012-08-31 19:22 strikosn at gmail dot com
  2012-09-03 10:41 ` [Bug c++/54441] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: strikosn at gmail dot com @ 2012-08-31 19:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54441

             Bug #: 54441
           Summary: Infinite loop with brace initializer on zero-length
                    array
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: strikosn@gmail.com


Consider this:

struct s { char c[]; };

int main()
{
    struct s s = { .c = 0 };
    return 0;
}

Compiling with 'g++ -Wall h.c' gives infinite warnings:

h.c: In function 'int main()':
h.c:5:24: warning: missing braces around initializer for 'char [0]'
[-Wmissing-braces]
h.c:5:24: warning: missing braces around initializer for 'char [0]'
[-Wmissing-braces]
h.c:5:24: warning: missing braces around initializer for 'char [0]'
[-Wmissing-braces]
h.c:5:24: warning: missing braces around initializer for 'char [0]'
[-Wmissing-braces]
...

Version: GNU C++ (GCC) version 4.7.0
Target: x86_64-unknown-linux-gnu


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

* [Bug c++/54441] [4.7/4.8 Regression] Infinite loop with brace initializer on zero-length array
  2012-08-31 19:22 [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array strikosn at gmail dot com
@ 2012-09-03 10:41 ` rguenth at gcc dot gnu.org
  2012-09-05  4:17 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-03 10:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54441

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.6.3
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2012-09-03
     Ever Confirmed|0                           |1
            Summary|Infinite loop with brace    |[4.7/4.8 Regression]
                   |initializer on zero-length  |Infinite loop with brace
                   |array                       |initializer on zero-length
                   |                            |array
   Target Milestone|---                         |4.7.2

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-03 10:41:11 UTC ---
Confirmed.  4.6 rejects the testcase with

t.C: In function 'int main()':
t.C:5:22: error: expected primary-expression before '.' token
t.C:5:16: warning: unused variable 's' [-Wunused-variable]


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

* [Bug c++/54441] [4.7/4.8 Regression] Infinite loop with brace initializer on zero-length array
  2012-08-31 19:22 [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array strikosn at gmail dot com
  2012-09-03 10:41 ` [Bug c++/54441] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
@ 2012-09-05  4:17 ` jason at gcc dot gnu.org
  2012-09-05  4:20 ` jason at gcc dot gnu.org
  2012-09-05 15:15 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-05  4:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54441

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-05 04:17:19 UTC ---
Author: jason
Date: Wed Sep  5 04:17:12 2012
New Revision: 190962

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190962
Log:
    PR c++/54441
    * decl.c (reshape_init_class): Handle invalid initializer for
    0-length array member.

    * error.c (dump_type_suffix): Correct handling of 0-length arrays.

Added:
    trunk/gcc/testsuite/g++.dg/ext/flexary3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/error.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/54441] [4.7/4.8 Regression] Infinite loop with brace initializer on zero-length array
  2012-08-31 19:22 [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array strikosn at gmail dot com
  2012-09-03 10:41 ` [Bug c++/54441] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
  2012-09-05  4:17 ` jason at gcc dot gnu.org
@ 2012-09-05  4:20 ` jason at gcc dot gnu.org
  2012-09-05 15:15 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-05  4:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54441

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-05 04:20:28 UTC ---
Fixed.


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

* [Bug c++/54441] [4.7/4.8 Regression] Infinite loop with brace initializer on zero-length array
  2012-08-31 19:22 [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array strikosn at gmail dot com
                   ` (2 preceding siblings ...)
  2012-09-05  4:20 ` jason at gcc dot gnu.org
@ 2012-09-05 15:15 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-05 15:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54441

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.2                       |4.8.0


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 19:22 [Bug c++/54441] New: Infinite loop with brace initializer on zero-length array strikosn at gmail dot com
2012-09-03 10:41 ` [Bug c++/54441] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-09-05  4:17 ` jason at gcc dot gnu.org
2012-09-05  4:20 ` jason at gcc dot gnu.org
2012-09-05 15:15 ` paolo.carlini at oracle dot com

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